PyCall Won't import gdal or osr

Hi everyone,

I wrote some code a few months ago that was working fine. Now that I am trying to use it again on the same computer without changing the code, I can’t import gdal or osr with pycall. However, numpy still imports without issue! I tried importing both packages from the python3 terminal an there were no errors. Here is the code and error:

using PyCall
using JLD
np=pyimport("numpy")
gdal = pyimport("gdal")
osr = pyimport("osr")
ERROR: PyCall.PyError("PyImport_ImportModule\n\nThe Python package osr could not be found by pyimport. Usually this means\nthat you did not install osr in the Python version being used by PyCal
l.\n\nPyCall is currently configured to use the Python version at:\n\n/usr/bin/python3\n\nand you should use whatever mechanism you usually use (apt-get, pip, conda,\netcetera) to install the P
ython package containing the osr module.\n\nOne alternative is to re-configure PyCall to use a different Python\nversion on your system: set ENV[\"PYTHON\"] to the path/name of the python\nexec
utable you want to use, run Pkg.build(\"PyCall\"), and re-launch Julia.\n\nAnother alternative is to configure PyCall to use a Julia-specific Python\ndistribution via the Conda.jl package (which installs a private Anaconda\nPython distribution), which has the advantage that packages can be installed\nand kept up-to-date via Julia.  As explained in the PyCall documentation,\nset ENV[\"PYTHON\"]=\"\", run Pkg.build(\"PyCall\"), and re-launch Julia. Then,\nTo install the osr module, you can use `pyimport_conda(\"osr\", PKG)`,\nwhere PKG is the Anaconda package the contains the module osr,\nor alternatively you can use the Conda package directly (via\n`using Conda` followed by `Conda.add` etcetera).\n\n", PyObject(Ptr{PyCall.PyObject_struct} @0x00007fb2fa4b0f60), PyObject(Ptr{PyCall.PyObject_struct} @0x00007fb2f6398a50), PyObject(Ptr{PyCall.PyObject_struct} @0x00007fb2f639a3c0))

Anyone have an idea? This is very frustrating. Thanks

You mean ogr instead of osr?
And at GDAL2.0 there was a merge of GDAL+OGR so likely you only want to import gdal

I have never used ogr. This code was working in December or January. I get the same error from trying to import gdal as osr, though they are both installed for python3…