cannot import name pool theano - python

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.

Related

Python imports aren't installing / can't be found

Firstly, I'm super new to Python/code and stackoverflow, so apologies if I sound like a child trying to explain complex rocket science.
I'm following a tutorial on creating a fake teachers database, and they say
import mysql.connector
from mysql.connector import Error
import panda
however, when I go to import, I get an error of
ImportError: Unable to import required dependencies:
pytz: No module named 'pytz'
dateutil: No module named 'dateutil'
Despite the modules being imported and in the Python folder. It took me around 30 minutes to get MySQL imported, and honestly I'm not even really sure how it fixed. I renamed the folder, I copied the folder into the virtual environment I'm using (which I'm not even sure how to not use that, it seems to just create difficulties in doing any importing), I had to reinstall pip multiple times as it also error'd the first 2 tries. I'm really confused and a little frustrated as I have zero idea how to fix this, or what even the errors are in the first place.
Any help would be much appreciated!!
Pip should be included with your Python installation. Try pip install mysql and pip install panda. If that doesn't work try py -m pip install mysql and py -m pip install panda.
Try:
pip3 install mysql pytz
You can install multiple packages at the same time!
If you want to get out of the virtual environment you created you can use the deactivate command.
See If pip is installed in your system
If its Installed , Install pytz by exeuting
pip install pytz
Install Pip = https://bootstrap.pypa.io/get-pip.py
Just download and run this file

I can't import sklearn modules anymore

Previously sklearn worked without a hitch. Since yesterday however, I receive the error message
'cannot import name 'logger'' , when I try to import a sklearn module (originally RobustScaler, but it happens for all sklearn modules now.) error message.
My sklearn version is 0.21.3 and I've tried to update the module (Requirements were already up-to-date) and to uninstall and then reinstall the module. This did not work either.
Your help would be appreciated!
Regards,
RM
EDIT: I solved it. I had to upgrade the joblib module (Through the command prompt). My former version was joblib 0.12.5 and my new version is joblib 0.13.2. The update command was pip install -U joblib.
check if you use many environments. For example under Anaconda, you can create different env (ex. Python 3.7 or 2.6).

scikit-learn package successfully updated, but continues to use/show old version

I just got access to a new server which has Python 2.7 and some packages already installed. However, I need the newest version of scikit-learn (0.18.0).
I tried to pip-upgrade the package, which returns the following affirmative message Successfully installed scikit-learn Cleaning up...
I used the following command, which worked for upgrading other packages (e.g. scipy):
OPENBLAS=/cluster/apps/openblas/0.2.13_seq/x86_64/gcc_5.2.0/lib python -m pip install --user --upgrade scikit-learn
When checking the version with pip freeze and python -c 'import sklearn; print sklearn.__version__' it continues to show the old version (0.17.1). In my home directory (I don't have root access) a folder named 'scikit_learn-0.18-py2.7.egg-info' was created.
Can someone point out what I'm doing wrong?
Edit: I'm on Centos 6 and packages like numpy and scipy worked just fine
Hi I was in the same situation as you, in order to get the correct version of sklearn, before importing it,
I added this line to my code:
import sys
sys.path.insert(0, '/home/your_user_name/.local/lib/python2.7/site-packages/')
I am not quite sure about the path part, but basically I think it is
sys.path.insert(0, '$HOME/.local/lib/python2.7/site-packages/')
Hope this helps.

ImportError: No Module named picklefield.fields (Yep pip install says it is there)

I am using vagrant to run my python environment. In my data models I am using django-picklefield module.
when I run my server it says
ImportError: No module named picklefield.fields.
I tried to uninstall and install the picklefield module. Still having the same problem.
You should be able install via:
/[your python install directory]/bin/pip install django-picklefield
If you do this directly instead of a general pip call to install django-picklefield, that will ensure that it is installed on the correct version of Python.
Based on your description my best guess is that you have multiple versions of Python installed, and that your install/uninstall is happening on the wrong one.

use package from pip local instead pip global

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/

Categories

Resources