0

I am an inexperienced Python user, so please forgive me if this is worded in a way that is somewhat confusing.

I currently use a Python setup that has been handed down to me by a colleague who has now left our team. I open Anaconda, use jupyter notebook to open the Jupyter Notebook browser program, then navigate to a folder containing many packages that my predecessors used. I do all of my coding in Jupyter Notebooks that are created within this folder.

I would like to add a new python package to my workflow (the package is GDAL, if that is relevant). I can't seem to find a way to add GDAL so that it can be used in this existing folder of Jupyter Notebooks that I normally work in.

I have created an environment that has GDAL, but as far as I understand, this is separate from the normal folder that I work in. Here is output when I call for environments:

# conda environments:
Note: you may need to restart the kernel to use updated packages.
#
base                  *  C:\Users\...\anaconda3
GdalEnv                  C:\Users\...\anaconda3\envs\GdalEnv

I did the above by coding into the Anaconda prompt itself. Trying the same workflow inside my Jupyter Notebooks does not allow me to use GDAL.

I'm sure that this is frustrating to read, as I really don't have a strong enough handle on Python to articulate myself here. If I could get any help or direction, I would be hugely appreciative. Please let me know if I can provide any other information to clear things up on my end. Thanks a ton for any help.

Tom
  • 377
  • 3
  • 13
  • once you open anaconda (or before, try both) have you tried `conda install GDAL` or `pip install GDAL`? – RufusVS Oct 06 '22 at 21:48
  • @RufusVS Thanks for the reply, do you mean that I should run `conda install GDAL` in Anaconda, then run `jupyter notebook` and work from there? Or should I be running `conda install GDAL` in my open Jupyter Notebook? – Tom Oct 06 '22 at 21:54
  • before you open your notebook, anyway. – RufusVS Oct 06 '22 at 21:54
  • @RufusVS this was helpful, as it showed a new issue. It seems that GDAL only runs in an older version of Python (3.6). I believe to use GDAL, I will have to create a new environment, as I did with GdalEnv in the above code. How should I integrate this with the current workflow described above? Is there a way to open this new environment from within a Jupyter Notebook that I started in the folder containing my normal workflow? – Tom Oct 06 '22 at 22:01
  • I don't know that there's any way to change python versions from within your notebook. You could, of course, set up multiple virtual environments, and activate the one you want prior to starting the notebook, but that doesn't sound like what you're asking. – RufusVS Oct 06 '22 at 22:28

0 Answers0