The code is like this
$ sudo pip install theano
Requirement already satisfied (use --upgrade to upgrade): theano in ./.local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.1 in /usr/lib/python2.7/dist-packages (from theano)
Requirement already satisfied (use --upgrade to upgrade): scipy>=0.11 in /usr/lib/python2.7/dist-packages (from theano)
Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in ./.local/lib/python2.7/site-packages/six-1.10.0-py2.7.egg (from theano)
Cleaning up...
~$ python -c"import theano;theano.test()"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named theano
I am sorry that I am still a freshman both in this site and linux.
That may due to the the two versions of python, so firstly I removed one and add the path for python to get the packages installed by pip, but it still does not help. Finally I came to to github to download it and unpackaged it, aftering test for around 30 minutes, it came out no errors, which means I setup it successfully.
After removing the previous version, I installed it as follows:
(http://deeplearning.net/software/theano/install_ubuntu.html)
git clone git://github.com/Theano/Theano.git
cd Theano
python setup.py develop --user
cd ..
Related
I am trying to run a python-script on an aws ec2-instance using jenkins.
I get the following error:
[ProdTest] $ /bin/sh -xe /tmp/jenkins14047325752732522807.sh
+ python3 prod.py
Traceback (most recent call last):
File "prod.py", line 2, in <module>
import base
File "/home/jenkins-slave-strat/workspace/ProdTest/base.py", line 3, in <module>
import boto3
ModuleNotFoundError: No module named 'boto3'
Build step 'Execute shell' marked build as failure
Finished: FAILURE
on the ec2 instance:
$ python3 --version
Python 3.7.9
$ pip3 install boto3 --user
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Requirement already satisfied: boto3 in /usr/local/lib/python3.7/site-packages (1.16.25)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /usr/local/lib/python3.7/site-packages (from boto3) (0.10.0)
Requirement already satisfied: s3transfer<0.4.0,>=0.3.0 in /usr/local/lib/python3.7/site-packages (from boto3) (0.3.3)
Requirement already satisfied: botocore<1.20.0,>=1.19.25 in /usr/local/lib/python3.7/site-packages (from boto3) (1.19.25)
Requirement already satisfied: urllib3<1.27,>=1.25.4; python_version != "3.4" in /usr/local/lib/python3.7/site-packages (from botocore<1.20.0,>=1.19.25->boto3) (1.26.2)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /usr/local/lib/python3.7/site-packages (from botocore<1.20.0,>=1.19.25->boto3) (2.8.1)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.20.0,>=1.19.25->boto3) (1.15.0)
How do i get python to access the packages in /usr/local/lib/python3.7/site-packages ?
Thanks to everyone taking the time!
Before I give a short answer, a few cautions:
I don't know what version of Linux (I assume) the EC2 instance is running.
As a result, it's unclear if Python 2 is installed, but since you used pip3 and not just pip, it seems like it might be.
You could try altering your $PATH variable, but it's generally considered a good practice to use virtual environments for Python. I'm personally a fan of Conda, but you can find guides for Pipenv as well. My advice is; install Conda via Miniconda, then do the following:
$ conda create --name myAppEnv python=your.python.version
$ conda activate myAppEnv
$ conda install [your libraries]
I have only very rudimentary experience in Python. I am trying to install the package pyslim (see here on the pypi website). I did
$ pip install pyslim
Requirement already satisfied: pyslim in ./Library/Python/2.7/lib/python/site-packages/pyslim-0.1-py2.7.egg (0.1)
Requirement already satisfied: msprime in /usr/local/lib/python2.7/site-packages (from pyslim) (0.6.1)
Requirement already satisfied: attrs in /usr/local/lib/python2.7/site-packages (from pyslim) (16.3.0)
Requirement already satisfied: svgwrite in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (1.1.12)
Requirement already satisfied: jsonschema in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (2.6.0)
Requirement already satisfied: six in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (1.10.0)
Requirement already satisfied: numpy>=1.7.0 in /usr/local/lib/python2.7/site-packages/numpy-1.10.4-py2.7-macosx-10.11-x86_64.egg (from msprime->pyslim) (1.10.4)
Requirement already satisfied: h5py in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (2.8.0)
Requirement already satisfied: pyparsing>=2.0.1 in /usr/local/lib/python2.7/site-packages (from svgwrite->msprime->pyslim) (2.2.0)
Requirement already satisfied: functools32; python_version == "2.7" in /usr/local/lib/python2.7/site-packages (from jsonschema->msprime->pyslim) (3.2.3.post2)
But when I open python and try to import pyslim, it fails
> import pyslim
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/remi/Library/Python/2.7/lib/python/site-packages/pyslim-0.1-py2.7.egg/pyslim/__init__.py", line 4, in <module>
from pyslim.slim_metadata import * # NOQA
File "/Users/remi/Library/Python/2.7/lib/python/site-packages/pyslim-0.1-py2.7.egg/pyslim/slim_metadata.py", line 1, in <module>
import attr
ImportError: No module named attr
So, I did
$ pip install attr
Requirement already satisfied: attr in /usr/local/lib/python2.7/site-packages (0.3.1)
and
$ pip install attrs
Requirement already satisfied: attrs in /usr/local/lib/python2.7/site-packages (16.3.0)
I restarted python and tried to import pyslim again but I keep receiving the same error message. I also tried to download and install the files from github by doing
$ git clone https://github.com/tskit-dev/pyslim.git
$ cd pyslim
$ python setup.py install --user
as indicated here on the pypi website. On this last line of code, I get a long output ending with
Download error on https://pypi.python.org/simple/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) -- Some packages may not be found!
No local packages or download links found for attrs
error: Could not find suitable distribution for Requirement.parse('attrs')
I am using Python 2.7.10 on a MAC OSX 10.11.6. Not sure if it matter but I usually install things with homebrew. I am using pip 18.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7).
Edit
$ which python
/usr/bin/python
$ which pip
/usr/local/bin/pip
Take a look to this other question that is related to the attrs package.
In your case, you have attr and attrs installed at the same time, and they are incompatible between them, so python is unable to resolve the package name on the import correctly.
You should use attrs only, so try uninstalling attr and try it again:
python -m pip uninstall attr
If, in the future, you need to have some packages incompatibles between them, take a look about using virtual environments in Python, which are really easy to use and will be very useful to play with packages and packages versions without break anything.
First uninstall pyslim. Use "pip uninstall pyslim". Then try installing again using
"conda install -c conda-forge pyslim"
Refer https://anaconda.org/conda-forge/pyslim
I am having difficulty installing Python Packages on Windows 10.The package name is Tabular..i have been trying over and over and it doesn't work out.her what i get when I try to install it using pip.Any help about it ?Thanks
C:\Python27\Scripts>pip install tabular
Collecting tabular
Using cached tabular-0.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "c:\users\pc\appdata\local\temp\pip-build-5mggv5\tabular\setup.py", line 50, in
raise ImportError("distribute was not found and fallback to setuptools was not allowed")
ImportError: distribute was not found and fallback to setuptools was not allowed
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\pc\appdata\local\temp\pip-build-5mggv5\tabular\
C:\Python27\Scripts>pip install distribute
Requirement already satisfied (use --upgrade to upgrade): distribute in c:\python27\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): setuptools>=0.7 in c:\python27\lib\site-packages (from distribute)
C:\Python27\Scripts>pip install --upgrade distribute
Requirement already up-to-date: distribute in c:\python27\lib\site-packages
Collecting setuptools>=0.7 (from distribute)
Downloading setuptools-25.1.6-py2.py3-none-any.whl (442kB)
100% |################################| 450kB 191kB/s
Installing collected packages: setuptools
Found existing installation: setuptools 25.1.1
Uninstalling setuptools-25.1.1:
Successfully uninstalled setuptools-25.1.1
Successfully installed setuptools-25.1.6
Tabular 0.1 has issues with Windows 10. Please fall back to 0.0.8
pip install tabular==0.0.8
Edit
For scipy installation on Windows 10 with python 2.7, instructions are at https://stackoverflow.com/a/38618044/5334188
I got this error when upgrading cvxpy using pip3. Does anybody know how to fix this? Thanks. The platform is OS X 10.11.2.
Collecting cvxpy
Using cached cvxpy-0.3.5.tar.gz
Requirement already satisfied (use --upgrade to upgrade): cvxopt>=1.1.6 in /usr/local/lib/python3.5/site-packages (from cvxpy)
Requirement already satisfied (use --upgrade to upgrade): ecos>=2 in /usr/local/lib/python3.5/site-packages (from cvxpy)
Requirement already satisfied (use --upgrade to upgrade): scs>=1.1.3 in /usr/local/lib/python3.5/site-packages (from cvxpy)
Collecting multiprocess (from cvxpy)
Using cached multiprocess-0.70.3.tgz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/private/var/folders/94/v_wjnx7x62n8x7dfr_734zy80000gn/T/pip-build-bwub59jx/multiprocess/setup.py", line 66, in <module>
meta_fh = open(os.path.join(here, '%s/__init__.py' % libdir))
FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/94/v_wjnx7x62n8x7dfr_734zy80000gn/T/pip-build-bwub59jx/multiprocess/py3.5/multiprocess/__init__.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/94/v_wjnx7x62n8x7dfr_734zy80000gn/T/pip-build-bwub59jx/multiprocess
Are you under Python 3.5?
If so it seems like the dependency to multiprocess has not been updated to python 3.5. However the installation scripts for 3.4 worked for me:
Go to https://pypi.python.org/pypi/multiprocess and download the 0.70.3.tgz file (bottom of the page)
tar -xvzf multiprocess-0.70.3.tgz
cd multiprocess-0.70.3 then mv py3.4 py3.5
python3 setup.py build
python3 setup.py install
pip3 install cvxpy
pip3 install nose
nosetests cvxpy should now work.
Despite my best effors, I can't seem to get gevent or grequests working. They both rely on greenlet which I can't get working either.
I've completely installed and reinstalled python via homebrew. I haven't tried using python's installer but I don't see why that would matter. I have upgraded xcode to the latest version and installed literally every plugin. I regularly have success installing python modules via pip. I've been trying to install grequests for the last month.
Computer:
Mac OSX Yosemite Version 10.10.1
MacBook Pro (Retina, 15-inch, Late 2013)
2.3 GHz Intel Core i7
16 GB 1600 MHz DDR3
Intel Iris Pro 1536 MB
`
$ sudo pip install greenlet
Requirement already satisfied (use --upgrade to upgrade): greenlet in /usr/local/lib/python2.7/site-packages
Cleaning up...
$ sudo pip install gevent
Requirement already satisfied (use --upgrade to upgrade): gevent in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): greenlet in /usr/local/lib/python2.7/site-packages (from gevent)
Cleaning up...
$ sudo pip install grequests
Requirement already satisfied (use --upgrade to upgrade): grequests in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): gevent in /usr/local/lib/python2.7/site-packages (from grequests)
Requirement already satisfied (use --upgrade to upgrade): requests>=1.0.0 in /Library/Python/2.7/site-packages (from grequests)
Requirement already satisfied (use --upgrade to upgrade): greenlet in /usr/local/lib/python2.7/site-packages (from gevent->grequests)
Cleaning up...
'
>>> import grequests
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import grequests
ImportError: No module named grequests
>>> import greenlet
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import greenlet
ImportError: No module named greenlet
>>> import gevent
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import gevent
ImportError: No module named gevent
Edit:
$ which -a python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/usr/local/bin/python
/usr/bin/python
Edit 2:
I must have broken something at some point because now none of the modules I install are coming through. The modules I've installed in the past still work but the new ones are getting the same errors as above.
After reinstalling everything, I still had the problem. I thought that /Library/Frameworks/Python.framework/Versions/2.7/bin/python was the system installed version, but it's not.
I needed to delete that and remove it from ~/.bash_profile that and then everything worked fine. I don't know if that was my only problem as the reinstall could have fixed something, but I think it was.