Discrepancy between `conda list` and importable python packages / libraries

123 Views Asked by At

Edited:

Issue:

I am experiencing a discrepancy between what Anaconda says is installed and what can actually be imported using Python.

I have installed in a virtual anaconda environment (gis) geopandas, gdal, pandas, etc.. Then I confirmed their installation by running conda list. Indeed all these libraries showed up in the list.

I then open Visual Studio and set the environment to (gis). Within the script I run import pandas, import geopandas, and from osgeo import gdal. Currently, the script get hung up on pandas. ModuleNotFoundError: No module named 'pandas'. If I try the others first, the same problem occurs.

Other Attempts:

I have also tried taking the pip approach from the terminal (outside of anaconda prompt).

1. Dowloading gdal from Christoph Gohlke's site "GDAL‑3.4.2‑pp38‑pypy38_pp73‑win_amd64.whl". -> Command prompt still didn't recognize gdal. -> Tried setting a path manually to the location of the gdal folder. -> Still not recognized.

2. Used a "custom dowload" from OSGeo4W setup, found the folder, manual set path to folder (made sure to delete previously set paths first). Result: same as above attempts.

3. Tried download from GIS internals support site. No result. I did notice though that this site did not include a version of gdal with an MSVC number that matched that of my verion of python (3.10.3) This made me suspect possibly that this was the problem for all my attempts? I did not want to risk downgrading python though as every time I change the version I seem to cause more issues.

I would reeeeeaaaaally appreciate if someone could help e through this problem. I have spent more time trying to configure my Python libraries and interpreters than writing scripts at this point.

Additionally, if there are any suggestions as to better names for this question that would likely result in it being more easily found.

1

There are 1 best solutions below

0
On BEST ANSWER

In the end I took the python virtual environment route and found this very helpfull link which did the trick for me.