Issue installing Theano in my virtualenv - virtualenv

I'm trying to install Theano in a virtualenv:
(dnouri_tut)[xxx#xxx virtualenvs]$ pip install Theano
but I get the following error:
Installing collected packages: scipy, numpy, Theano
Running setup.py install for scipy
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-JcZ_Qe/scipy/setup.py", line 249, in <module>
setup_package()
File "/tmp/pip-build-JcZ_Qe/scipy/setup.py", line 237, in setup_package
from numpy.distutils.core import setup
ImportError: No module named numpy.distutils.core
Complete output from command /home/xxx/virtualenvs/dnouri_tut/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-JcZ_Qe/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-T3NhHj-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/xxx/virtualenvs/dnouri_tut/include/site/python2.6:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-JcZ_Qe/scipy/setup.py", line 249, in <module>
setup_package()
File "/tmp/pip-build-JcZ_Qe/scipy/setup.py", line 237, in setup_package
from numpy.distutils.core import setup
ImportError: No module named numpy.distutils.core
----------------------------------------
Command "/home/xxx/virtualenvs/dnouri_tut/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-JcZ_Qe/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-T3NhHj-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/xxx/virtualenvs/dnouri_tut/include/site/python2.6" failed with error code 1 in /tmp/pip-build-JcZ_Qe/scipy
I would like not to depend on any system package, so I didn't use the option "--system-site-packages" to create my virtualenv.
Anybody can help?

As pointed out by user1615070, I just had to install numpy and scipy in my virtualenv before installing Theano (to not use the system versions).

To be more specific, Theano (at least version 0.8) has the specific command in its documentation. Here it is:
virtualenv --system-site-packages -p python2.7 theano-env

Related

I'm getting an error importerror /lib/arm-linux-gnueabihf/libm.so.6 version glibc_2.29' not found what should I do?

While I run my python code in raspberry pi 3b+ I'm getting:
importerror /lib/arm-linux-gnueabihf/libm.so.6 version glibc_2.29' not
found
error what should I do?
#beginner
pi#raspberrypi:~/Desktop/Mirror-Interface-Auth/RaspberryPi-Module $ python3 main.py
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/firebase_admin/firestore.py", line 22, in <module>
from google.cloud import firestore # pylint: disable=import-error,no-name-in-module
File "/home/pi/.local/lib/python3.7/site-packages/google/cloud/firestore/__init__.py", line 18, in <module>
from google.cloud.firestore_v1 import __version__
File "/home/pi/.local/lib/python3.7/site-packages/google/cloud/firestore_v1/__init__.py", line 30, in <module>
from google.cloud.firestore_v1._helpers import GeoPoint
File "/home/pi/.local/lib/python3.7/site-packages/google/cloud/firestore_v1/_helpers.py", line 22, in <module>
from google.api_core import gapic_v1
File "/home/pi/.local/lib/python3.7/site-packages/google/api_core/gapic_v1/__init__.py", line 16, in <module>
from google.api_core.gapic_v1 import config
File "/home/pi/.local/lib/python3.7/site-packages/google/api_
From this thread, it seems an older version must be installed to work.
sudo pip3 uninstall grpcio
sudo pip3 uninstall grpcio-status
Then
sudo pip3 install grpcio==1.44.0
sudo pip3 install grpcio-tools==1.44.0
After doing this my Raspberry Pi Zero W 2 does not fail upon importing the packages.

Installing google-cloud-vision

I'm new to raspberry pi, google cloud, python, somewhat new to linux and would like a suggestion on how to fix/debug this problem. I'm getting an error when I install the Cloud Vision API Client Libraries for python.
It seems that this installation breaks pip and pip3 on raspian. Here's how I reproduced the problem from a fresh install of raspian:
pi#raspberrypi:~ $ pip --version
pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)
pi#raspberrypi:~ $
pi#raspberrypi:~ $ sudo pip install --upgrade google-cloud-vision
...
...
At the end of the log:
Running setup.py install for dill
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 12, in <module>
import setuptools.version
File "/usr/local/lib/python2.7/dist-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 70, in <module>
import packaging.version
ImportError: No module named packaging.version
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-1dbzT3/dill/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lUJmAy-record/install-record.txt --single-version-externally-managed --compile:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 12, in <module>
import setuptools.version
File "/usr/local/lib/python2.7/dist-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 70, in <module>
import packaging.version
ImportError: No module named packaging.version
Afterwards, when I run pip, I get this:
pi#raspberrypi:~ $ pip --version
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 70, in <module>
import packaging.version
ImportError: No module named packaging.version
I'm not sure how to go about fixing this.
There's a trick to installing the cloud client libraries on Raspberry Pi: install virtualenv and sphinx first. The following steps will get you going:
sudo apt-get install python-pip virtualenv python-dev
virtualenv env
source env/bin/activate
pip install sphinx
pip install --upgrade google-cloud-vision
python

orange3-associate install fails, other add-ons install without issue

Install error for Orang3-Associate add-on on a Windows7 PC
Command:
pip install Orange3-Associate (same result from UI Options - Add-Ons)
Error:
Collecting Orange3-Associate
Using cached Orange3-Associate-0.1.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "C:\cygwin64\tmp\pip-build-nzb1zehp\Orange3-Associate\setup.py", line 32, in <module>
long_description=open(path.join(path.dirname(__file__), 'README.md')).re ad(),
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\cygwin64\\tmp\\ pip-build-nzb1zehp\\Orange3-Associate\\README.md'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\cygwin64\tmp\p ip-build-nzb1zehp\Orange3-Associate
Add-ons DataFusion and Text successfully installed.
Thanks. This was a bug in Orange3-Associate 0.1.1. It is hopefully fixed in 0.1.2, already available through pip or Options | Add-ons.

Virtualenv causing setuptools error

I am having trouble running a virtualenv, and I keep getting this same error code: "setuptools pip wheel failed with error code 1"
I saw some pages talking about how this is a discrepancy between different versions of setuptools, but I've uninstalled and reinstalled virtualenv and setuptools in several versions to no results. Does anyone know what's happening here?
Roberts-MacBook-Air:script Rob$ virtualenv venv
New python executable in venv/bin/python
Installing setuptools, pip, wheel...
Complete output from command /Users/Rob/Seedstages/script/venv/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/__init__.py", line 13, in <module>
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/utils/__init__.py", line 15, in <module>
File "/Users/Rob/anaconda/lib/python2.7/zipfile.py", line 6, in <module>
import io
File "/Users/Rob/anaconda/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/Users/Rob/Seedstages/script/venv/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyErr_ReplaceException
Referenced from: /Users/Rob/Seedstages/script/venv/lib/python2.7/lib-dynload/_io.so
Expected in: dynamic lookup
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/Users/Rob/anaconda/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv.py", line 832, in main
symlink=options.symlink)
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv.py", line 1004, in create_environment
install_wheel(to_install, py_executable, search_dirs)
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv.py", line 969, in install_wheel
'PIP_NO_INDEX': '1'
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv.py", line 910, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/Rob/Seedstages/script/venv/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code 1
Roberts-MacBook-Air:script Rob$
I would say that Anaconda causes the conflict, though to be more specific, it appears as if Anaconda's virtualenv is the problem. Running which virtualenv on my macbook (where I'm having the same problem) yields /Users/me/anaconda/bin/virtualenv while running it on the linux system I just tested this on yields /usr/local/bin/virtualenv.
So, on OS X, I downloaded virtualenv using /usr/local/bin/pip install virtualenv. This doesn't create a virtualenv binary (or it didn't for me) in the PATH folders, so I had to type this painfully long command:
sudo /usr/local/bin/python ... {the path to virtualenv.py in the system python's site-packages folder} new_env
And that did it. But that's ridiculous. No one wants to do that - even creating links would still be hacking it when you don't need to.
According to the ContinuumIO github page on this very subject, the virtualenv env and source /bin/activate commands are replaced with conda create -n env python=2.7 and source activate env.
Tested on my macbook (running Anaconda2 v4 on OS Yosemite) and it worked out.

virtualenvwrapper no longer installs

I build a development environment using vagrant and virtualenv/virtualenvwrapper. Recently, my vagrant box stopped provisioning correctly. It seems virtualenvwrapper won't install anymore. I am trying to trace down what has changed. What has changed?
My Vagrantfile and install.sh files are here: https://gist.github.com/ErikEvenson/9763878. Note that this error happens on the web box.
This is the error I get when I try to install virtualenvwrapper:
vagrant#vagrant-ubuntu-precise-64:~$ pip install virtualenvwrapper
Downloading/unpacking virtualenvwrapper
Downloading virtualenvwrapper-4.2.tar.gz (125Kb): 125Kb downloaded
Running setup.py egg_info for package virtualenvwrapper
Installed /home/vagrant/build/virtualenvwrapper/pbr-0.7.0-py2.7.egg
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/home/vagrant/build/virtualenvwrapper/setup.py", line 7, in <module>
pbr=True,
File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 221, in __init__
self.fetch_build_eggs(attrs.pop('setup_requires'))
File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 245, in fetch_build_eggs
parse_requirements(requires), installer=self.fetch_build_egg
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 588, in resolve
raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (pip 1.0 (/usr/lib/python2.7/dist-packages), Requirement.parse('pip>=1.4'))
Complete output from command python setup.py egg_info:
Installed /home/vagrant/build/virtualenvwrapper/pbr-0.7.0-py2.7.egg
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/home/vagrant/build/virtualenvwrapper/setup.py", line 7, in <module>
pbr=True,
File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 221, in __init__
self.fetch_build_eggs(attrs.pop('setup_requires'))
File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 245, in fetch_build_eggs
parse_requirements(requires), installer=self.fetch_build_egg
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 588, in resolve
raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (pip 1.0 (/usr/lib/python2.7/dist-packages), Requirement.parse('pip>=1.4'))
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/vagrant/.pip/pip.log
Erik, while your answer may work it's not necessary I don't think. Have you tried apt-get install virtualenvwrapper?
The reason I ask is that ubuntu already has you "sudo apt-get install python-virtualenv" (which also installs python-pip), and I had no problem also apt-get install'ing virtualenvwrapper. The only difference is you have to "source /etc/bash_completion.d/virtualenvwrapper" in your bashrc instead of /usr/local/bin/virtualenvwrapper.sh.
You can still try back your way out of what you've done (don't blame me if it doesn't work though!):
$ sudo apt-get uninstall python-pip
$ sudo apt-get install python-pip
$ sudo pip uninstall virtualenvwrapper
$ sudo apt-get install virtualenvwrapper
then add source /etc/bash_completion.d/virtualenvwrapper to ~/.bashrc
Something like that. Good luck!
Running pip install --upgrade pip after doing apt-get install python-pip seems to have done the trick. This bring pip up to 1.5.4 and avoids the error above. Also, be sure to use /user/local/bin/pip for the rest of the provisioning script.
I'm not sure what changed to make my provisioning dependent on pip > 1.0 though. Would be nice to know so that I can lock that dependency down.
You can try
sudo apt-get install python-virtualenv virtualenwrapper.