I have installed python and miniconda (I had installed conda before but it didn't work so I opted for miniconda). I opened my anaconda prompt, created my environment, imported all my packages including gdal
: conda install -c conda-forge gdal
.
When I try to run my python program in the anaconda prompt
(StageEnv) C:\Users\julia\Documents\Stage\QGis\QGis1>python3 interannual_mean_values.py
I get the error
Traceback (most recent call last):
File "C:\Users\julia\Documents\Stage\QGis\QGis1\interannual_mean_values.py", line 3, in <module>
import gdal
ModuleNotFoundError: No module named 'gdal'
I have already looked at the solutions proposed here can't import gdal in python?
I also tried from osgeo import gdal
but that doesn't work either : when I tried to install osgeo, conda couldn't find it, then I check in the folder where there are all the libs (C:\Users\julia\miniconda3\envs\StageEnv\Lib\site-packages) and there is osgeo. But when I runned it, I had the error no module named 'osgeo'
.
Can anyone help please ^^'?
Thanks!
(PS: I'd like to point out that I don't run my code from my IDE (VS) because I get no module named numpy
error. The error seems to come from the environment: when I open my file, the prompt automatically runs:
PS C:\Users\julia> C:/Users/julia/miniconda3/Scripts/activate
PS C:\Users\julia> conda activate StageEnv
and it's indeed the name of my environment that is displayed as my interpreter. However, when I type conda list
in the prompt it outputs the base environment, thus without all the libraries I have installed and not the one in my environment.I've already manually added the miniconda directory to the PATH environment variable. I think it is due to the first line, but as in conda it seems to work until my problem with no module named gdal
, I was fine with using it).