I have Theano library installed on
/usr/local/lib/python2.7/dist-packages/theano/
but the Theano installed is the old one and I am using some library that can't import some packages.
So I tried to install the new one using
pip install --user theano in ~/.local
but everytime I import theano, the version is the old one which come from
/usr/local/lib/python2.7/...
So I need to know how to make import theano load my ~/.local theano, not the /usr/local/lib theano.
Thank you :)
The problem is that the old version wasn't installed with pip, but probably with easy_install. This cause many type of problems.
You can fix it by changing the import order after starting python. To do so, in your python script before importing theano do something like this:
import sys
sys.path[0:0] = ["THE_PYTHON_PATH_YOU_WANT_TO_ADD"]
THE_PYTHON_PATH_YOU_WANT_TO_ADD is something like ~/.local/lib/python2.7/site-packages/
Related
I am trying to open a .netcdf file using xarray and it is showing this error. I am unable to resolve this error and I have found no such solution to resolve this error. I have tried with different versions of Anaconda and Ubuntu but the problem persists.
ValueError: did not find a match in any of xarray's currently installed IO backends ['scipy']. Consider explicitly selecting one of the installed backends via the engine parameter to xarray.open_dataset(), or installing additional IO dependencies:
http://xarray.pydata.org/en/stable/getting-started-guide/installing.html
http://xarray.pydata.org/en/stable/user-guide/io.html
I had the same issue. I then installed netCDF4 via:
pip install netCDF4
and xarray worked. Beware of dependencies!!
I had the same problem as well. In this matter, you need to install IO dependencies.
Based on their web site here you need to install all IO related packages:
io = netCDF4, h5netcdf, scipy, pydap, zarr, fsspec, cftime, rasterio, cfgrib, pooch
conda install -c anaconda netcdf4 h5netcdf scipy pydap zarr fsspec cftime rasterio cfgrib pooch
Based on your error message, it looks like you are only missing the scipy dependency.
I would recommend installing using conda install in either your terminal/command line or in Jupyter (if you use that IDE):
conda install scipy
If you are using a Python environment other than your base environment, ensure you are installing to the environment are using for the project by navigating there in terminal (e.g., conda activate MYENV), or by running that environment kernel in Jupyter.
You may need to restart the kernel if you are using Jupyter for the change to take effect.
conda install scipy
solves the problem
This error message can also be triggered when simply having an error in the path to the file to be opened. For example this results in the same/similar error (even with the netcdf backend installed):
import xarray as xr
xr.open_dataset("this_file_does_not_exist.nc")
So before (re)installing any packages, make sure to check whether the input to xr.open_dataset() is correct.
when I try to import any module that I installed with pip3, the system just sends me tons of texts. I am sorry I can't specify any better, but I am new to python and ubuntu. I tried the command pip3 list and then I get this:
/usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
/usr/lib/python3/dist-packages/secretstorage/util.py:19: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
And after that, I get the list with some packages and their versions. And the packages that I remember installing don't appear in the list, like NumPy or random. I am using python 3.8 and pip 3.
Everything was perfect, but I tried to install the visual or python module, and after that, I got that error. I think I tried to install the modules with pip and after with conda. And I have no ideia in what to do.
Try upgrading the cryptography library, something like this:
pip install cryptography==3.3.2
I'm totally new using Python and I have to learn quickly because of my job. I have downloaded Python2.7.13 (and also the pip package. My next step was:
C:\Python27\pip install keras
And it finished saying that theano and anaconda2 were installed to and also was fine.
The problem came when I tried the following line:
C:\Python27\python
>>>from keras.models import Sequential
And I get the following message (after others that don't give error):
ImportError: No module named numpy
The fact is that I got out of python and try pip install numpy and it says that I have already have numpy installed and show me in which folder I have it. So I go to that folder and try:
C:\users\maca\anaconda2\lib\site-packages\numpy\python setup.py install
And that returns:
This is the wrong setup.py file to run
I'm totally new so I'm very lost about what my next step should be and how to fix it, 'cause I'm not familiarized with Python. I would thank any understandable help.
Thanks in advance.
It sounds like you have vanilla python installed in C:\Python27\ and Anaconda installed in C:\Users\Maca\Anaconda2. These are different. Anaconda is not an add-on to python, it is a distribution of python. Anaconda will have the math prerequisites, vanilla will not. You can install Keras on vanilla (it's hard), but it sounds like you want to use Anaconda. Then use only anaconda. Run:
activate root
You should then be using Anaconda and you can run:
pip install keras
Also, keras works on top of a backend so make sure you either have theano (pip install theano) or tensorflow.
Then, in the same console window, using Anaconda, run python and type from keras.models import Sequential. It should work.
From then on, you can access anaconda (as long as it was set up with this command enabled) with activate root. This will set python and related arguments to refer to Anaconda rather than the default C:\Python27.
EDIT: If in the future you are planning to use only anaconda, you can delete C:\Python27 from your path or even add Anaconda to it. To add anaconda to you path, look up environment variables in the start menu, go to the system environment variables, and find PATH. If you haven't uninstalled Python27 yet you'll need to remove C:\Python27\ from that path, and then you can add C:\Users\Maca\Anaconda2 anywhere (probably towards the end depending on how often you use python and how cluttered your path is).
You are already using Anaconda Python distribution so you should use conda package manager for installing keras: run conda install keras in your terminal. This will install keras and all the dependencies.
as written in the title, I cannot import pool
specifically,
from theano.tensor.signal import pool
doesn't work.
It says
ImportError: cannot import name pool
I tried to update theano by
sudo pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
Then, it shows 'Successfully installed Theano-0.9.0.dev2' but still cannot import pool.
When I write these code in the python interpreter
import theano
theano.__version__
Then it says '0.7.0.dev-f986e0dd35f .... '
I think still I am using 0.7.0 version but I don't know how to do.
Would you plz tell me how to solve importing error?
You probably have two Pythons installed on your system, one of them locally and the other globally. When you sudo pip install, you install the latest Theano for your global installation of Python. However, when you run Python, you run the local Python with the old version of the Theano.
I have the following programs installed
python 2.7 installed
Numpy-1.6.2-python2.7
Matplotlib-1.1.1-py2.7
I believe numpy has been installed properly because when I type import numpy in python interpreter, it doesn't give me an error. I can also check the version of the numpy installed.
I am getting the following error in my code on this line
import numpy as np
"Exceptions.ImportError:No module named numpy"
Does anyone know a solution to this problem? Thanks!
in terminal:
sudo apt-get install python-numpy
Sounds like you have another version of Python installed that PyScript is seeing. Easiest solution is to not use PyScript, but you may be able to fix it by re-installing/re-configuring PyScript to make sure that it points to the same location/version of your Python27
Chances are you have multiple versions of python installed, type:
which python
in your terminal, see what's the current one.
I've same issue on Mac.
But I solve it. I have two versions of pip.Look....
MacBook-Pro:WhiteBoxSMS4-master qinyao$ which pip
/Library/Frameworks/Python.framework/Versions/3.6/bin/pip
MacBook-Pro:WhiteBoxSMS4-master qinyao$ which pip2
/usr/local/bin/pip2
so,you need check you pip version.
Like others have mentioned you have multiple versions of python installed. Check by typing:
which python
then you can use she-bang to set your script to the version of python you can use numpy with (the one you used on your command line).
Or set your PYTHONPATH variable
I've same issue on Mac OS X.
The numpy has been installed at '/Library/Python/2.7/site-packages/numpy-override',
so import numpy works normaly.
But will fail while virtualenv actived, and with non-system preinstalled python(e.g. homebrew, or macport).
$ which python
/usr/local/bin/python
Fixed by install it again in virtualenv(which created with --no-site-packages option, or without --system-site-packages).
Pylab is part of matplotlib; so you can simply install matplotlib and you will automatically get pylab, too.