Spyder does not find gdal package even though it is installed - python

I have installed gdal with miniconda in the working environment for spyder. After restarting the PC, the conda list shows me that gdal is installed. However, I can not import the package.
"""Error: No module named 'gdal'"""
The PythonPath Manager did not solve the problem either. I have also manually installed georasters, which was recommended elsewhere.
Does anyone have an idea what the problem is? The problem is only with gdal. I have installed geopandas as a test and it works as it should.
Miniconda Terminal

You need to use
from osgeo import gdal
See documentation: https://gdal.org/api/python_bindings.html

Related

Adding libraries in Spyder

I installed the libraries I needed by using these commands below:
conda install matplotlib
conda install numpy
I see the '# All requested packages already installed.' in terminal. But when I try to run the code again, I get this warning: ModuleNotFoundError: No module named 'matplotlib.pylot'
Can somebody help me how to fix this problem?
This is likely occurring because the environment in which you installed the packages is not the one set as interpreter in spyder. See how to change interpreter in spyder here

After updating Anaconda-Navigator environments dont work

I updated Anaconda-Navigator to 1.9.12 on ubuntu and now my environments dont work.
I can still start a jupyter notebook from the environment but all my installed packages are not available even though they are displayed in the anaconda-navigator gui under installed packages for this env.
but when I import a package in a notebook : ModuleNotFoundError: No module named ....
The standard packages like numpy are available though...
Please help me... why did I update!!!!????
maybe a path problem? Please help me in simple terms
Thanks
I think this is a bug. My experiance is that when you upgrade to Navigator to 1.9.12.
the enviroment variables in GUI(Navigator UI), are taken from base enviroment not from second enviroment and if you work from console it work, so it looks like it not executes conda activate new_environment in gui. When you work from terminal everythings works fine.
To be honest it has the same behaviour if fresh install last anaconda too. This was the reason i have downgraded conda isntallation, and than i found out that last version of navigator was making the issues . Or you can downgrade:
conda install anaconda-navigator=1.9.7.

ImportError: No module named 'matplotlib' with tensorflow

I am a Korean student who wants to learn TensorFlow.
It works when matplolib is turned and works when TensorFlow is set aside.
However, when used together, such a problem occurs.
What's the problem?
Looking at your pictures, my guess would be that tensorflow and matplotlib are installed in separate virtual environments.
Either install both of them globally or install them both in the same virtual environment.
In the first image, you are in the environment, while in the second image, you aren't in any environment. If you plan on using an environment, make sure all packages needed are inside. To check if you have a package, do import whateverpackageitis in python. If it's not in the environment you desire, just do pip install whateverpackageitis in the windows terminal.
So, the solution would be running pip install matplotlib in the tensorflow environment.

Python Anaconda - no module named numpy

I recently installed Anaconda on Arch Linux from the Arch repositories. By default, it was set to Python3, whereas I would like to use Python2.7. I followed the Anaconda documentation to create a new Python2 environment. Upon running my Python script which uses Numpy, I got the error No module named NumPy. I found this rather strange, as one of the major points of using Anaconda is easy installation of the NumPy/SciPy stack...
Nevertheless, I ran conda install numpy and it installed. Now, I still cannot import numpy, but when I run conda install numpy it says it is already installed. What gives?
Output of which conda: /opt/anaconda/envs/python2/bin/conda
Output of which python: /opt/anaconda/envs/python2/bin/python
The anaconda package in the AUR is broken. If anyone encounters this, simply install anaconda from their website. The AUR attempts to do a system-wide install, which gets rather screwy with the path.

ImportError: No module named ... after spyder install

Anaconda Spyder is supposed to include numpy, scipy etc with the installation. Someone has installed Spyder for me on Windows 7 but if I try to import numpy or scipy , I get this error:
import numpy as np
ImportError: No module named numpy
I also can't run "conda" on the console.
What's wrong? What should I do to fix this? I tried adding PYTHONPATH in environment variables but no difference.
How can I check if they're even installed? I searched for NumPy in the computer, I only found the following:
It sounds like someone installed just spyder, not Anaconda, which is a separate thing (Anaconda is a collection of several Python packages, including Spyder, NumPy, and SciPy). Try downloading and installing Anaconda and using the Spyder that comes with that.
The thing is you have to install python 2.7. Surely you have a different python installed. If you download and install Python 2.7 this should works. Other thing you can do is search for the Anaconda Spyder version that support the Python you have installed.
It's probably that your the python core version of your spyder environment is different from the conda python version.
Python core version of your spyder environment
Conda python version
So you should make them of the same version then the problem will be solved.

Categories