Boto package installed with pip not showing up in list - python

Package is boto (Amazon AWS).
(myvirtualenv)$ pip install --target /Users/me/Projects/myproject boto
Downloading/unpacking boto
Downloading boto-2.30.0.tar.gz (7.1MB): 7.1MB downloaded
Running setup.py egg_info for package boto
...
Successfully installed boto
Cleaning up...
(myvirtualenv)$ pip list
bpython (0.12)
Django (1.6.1)
mock (1.0.1)
PIL (1.1.7)
pip (1.4.1)
Pygments (1.6)
python-dateutil (2.2)
selenium (2.39.0)
setuptools (0.9.8)
six (1.4.1)
wsgiref (0.1.2)
(myvirtualenv)$
No boto is listed. Nothing interesting in the pip log.
Any ideas?

Installing boto3 using below shows boto3 in the list.
sudo python -m pip install boto3

You are not installing it as part of your python installation. You are installing the package to a specific directory using the --target option.
Without the --target option, your package would be installed to the site-packages directory of your python installation.
You find your site-packages directory(s) like this:
~$ python
>>> import site
>>> site.getsitepackages()
['<path>', ...]
>>>
pip list shows the pip installed packages in site-packages.
In other words, your package boto is not "installed" at all, and you won't be able to do the following without getting an error:
~$ python
>>> import boto
>>>
Unless you happen to be in the /Users/me/Projects/myproject directory at the time.

Related

Update python library offline

I need to update offline a library in Python.
I have downloaded the library with pip download and then I try to update the library with the command:
pip install --no-index --user --find-links /tmp/pip/ --upgrade Werkzeug==0.15.5
which gives:
Ignoring indexes: https://...
Collecting Werkzeug==0.15.5
Installing collected packages: Werkzeug
Successfully installed Werkzeug-0.11.15
and then the library stays in the same version!
pip freeze | grep Wer
Werkzeug==0.11.15
Any ideas why this happens?
UPDATE: After the comment from #hoefling I rerun with the -vvv option and this is what I got:
pip install --no-index --user --find-links /tmp/pip2/ -vvv Werkzeug==0.15.5
Ignoring indexes: https://pypi:pypi#..../simple/
Collecting Werkzeug==0.15.5
0 location(s) to search for versions of Werkzeug:
Skipping link /tmp/pip2/werk/ (from -f); not a file
Found link file:///tmp/pip2/werk/Werkzeug-0.15.5-py2.py3-none-any.whl, version:
0.15.5
Local files found: /tmp/pip2/werk/Werkzeug-0.15.5-py2.py3-none-any.whl
Using version 0.15.5 (newest of versions: 0.15.5)
Installing collected packages: Werkzeug
Successfully installed Werkzeug-0.11.15
Cleaning up...
Try this command:
pip install Werkzeug-0.15.5.tar.gz
and the result must be like this:
Processing ./Werkzeug-0.15.5.tar.gz
Installing collected packages: Werkzeug
Running setup.py install for Werkzeug ... done
Successfully installed Werkzeug-0.15.5
This behaviour can happen because pip by default works with system Python which is located in /usr/bin/ on Linux. When installing the package, by giving Python --user flag your package is installed in your user's version of Python, probably located somewhere in ~/.local/.
To solve the problem you can install the package to your system Python, which is generally not recommended without --user flag. Another option is to use virtual environments and have the distribution that is made specifically for your project. Currently the recommended way is using venv.
$ python -m venv env
$ source env/bin/activate
(env) $ pip install ... (packages you need to install without --user flag)
(env) $ pip freeze
# should give you the packages you installed
This can help you not only with this example, but it can always keep your system Python installation clean and if you mess something up, you will only mess the environment you are having for specific project.

No module named soundfile

Whenever I try to import soundfile I get the error
ImportError: No module named soundfile
I installed pysoundfile seemingly without trouble:
$ sudo pip install pysoundfile
The directory '/Users/theonlygusti/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/theonlygusti/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pysoundfile
Downloading PySoundFile-0.9.0.post1-py2.py3.cp26.cp27.cp32.cp33.cp34.cp35.cp36.pp27.pp32.pp33-none-macosx_10_5_x86_64.macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.whl (573kB)
100% |████████████████████████████████| 573kB 430kB/s
Requirement already satisfied: cffi>=0.6 in /Library/Python/2.7/site-packages (from pysoundfile)
Requirement already satisfied: pycparser in /Library/Python/2.7/site-packages (from cffi>=0.6->pysoundfile)
Installing collected packages: pysoundfile
Successfully installed pysoundfile-0.9.0.post1
so what's causing this problem?
Check if it is installed in a test environment
Example Ways
$ pip install virtualenv
$ python -m virtualenv venv
$ source venv/bin/activate
$ pip install pysoundfile
$ python
>>> import soundfile
PySoundFile depends on the Python packages CFFI and NumPy, and the system library libsndfile.
To install the Python dependencies, I recommend using the Anaconda distribution of Python 3.
This will come with all dependencies pre-installed. To install the dependencies manually, you can use the conda package manager, which will install all dependencies using conda install cffi numpy (conda is also available independently of Anaconda with pip install conda).
With CFFI and NumPy installed, you can use pip install pysoundfile to download and install the latest release of PySoundFile. On Windows and OS X, this will also install the library libsndfile. On Linux, you need to install libsndfile using your distribution's package manager, for example sudo apt-get install libsndfile1.
I had the same problem, I guess the problem is with python versions. When I tried with Python 3.5.2
python3 file_name.py
ImportError: No module named 'soundfile'
Instead, I tried the same with Python 2.7.12
python file_name.py
It successfully imported it!
For Google Colab Research
copy paste this
!pip install soundfile
& then import it
import soundfile

PIP Failed to create process

Python Version 2.7
On windows 10 64bits
pip install <whatever>
command not working.
C:\new_software\Python27\Scripts>python -m ensurepip
Requirement already satisfied: setuptools in c:\new_software\python27\lib\site-packages\setuptools-28.8.0-py2.7.egg
Requirement already satisfied: pip in c:\new_software\python27\lib\site-packages\pip-9.0.1-py2.7.egg
C:\new_software\Python27\Scripts>python -m ensurepip --upgrade
Requirement already up-to-date: setuptools in c:\new_software\python27\lib\site-packages\setuptools-28.8.0-py2.7.egg
Requirement already up-to-date: pip in c:\new_software\python27\lib\site-packages\pip-9.0.1-py2.7.egg
C:\new_software\Python27\Scripts>pip install wheel
failed to create process.
C:\new_software\Python27\Scripts>python -m install pip install pip
C:\new_software\Python27\python.exe: No module named install
I have python 3.x and 2.7; in 3.x pip works fine; only in 2.7 it aint.
Based on reading articles online: I have completed:
1.environment variable set up.
2.python VC++ installed
Thank you all for your response. I read the link shared by #cricket_007.
Solution:
Update all .py files [firstline] inside /Scripts folder with current path of Python Home. You will notice it will be pointing to an older location.
Then try running pip command from new CMD prompt, should work fine.

Python pip install mysql-connector-python 2.0.1 fails

In developing a Django application, I used the following command to install MySQL (python3):
(Venv)$ pip3 install mysql-connector-python --allow-external mysql-connector-python
The installation was sucessful, and pip3 freeze > requirements.txt shows that mysql-connector-python==2.0.1 was installed.
However, in the production environment, pip3 install -r requirements.txt produced the following error message.
Downloading/unpacking mysql-connector-python==2.0.1 (from -r requirements.txt (line 6))
Could not find any downloads that satisfy the requirement mysql-connector-python==2.0.1 (from -r requirements.txt (line 6))
Is this a bug?
There is an outstanding bug with the way it is packaged on PIP.
here are the details: http://bugs.mysql.com/bug.php?id=76063
You can use following commands to install mysql-connector as mentioned on same link :
wget https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.3.zip
unzip mysql-connector-python-2.0.3.zip
cd mysql-connector-python-2.0.3
python setup.py install
pip can not install mysql-python-connector due to an error on the part of its package maintainers. Here is the relevant issue filed against that package's bug tracker. Although technically it should be installable with
pip install --allow-external mysql-connector-python --allow-unverified mysql-connector-python mysql-connector-python
this does not work if the package maintainers fail to correctly register the external URLs to PyPI.
Note that PyMySQL appears to be a complete drop-in replacement, as a pure-Python MySQL driver that implements the Python DB API 2.0 specification. Additionally, PyMySQL appears to be actively maintained, uploaded to PyPI (as opposed to hosted on external URLs), and is under the more generous MIT license (as opposed to the GPLv2 license).
Try this if you do not want to install manually:
sudo pip3 install --extra-index-url https://pypi.python.org/pypi/mysql-connector-python/2.0.4 mysql-connector-python
Works for me on Debian Jessie.

Why I cannot install a module from PyPI using pip but I can install it using easy_install?

I am trying to install waferslim (A python port of the fitnesse slim server and protocols) into my python environment. Waferslim is in the Python package library PyPI, however when I try to install it using pip it doesn't work, I get a package not found error:
(test) C:\Python27\VirtualEnvs\test\Scripts>pip install waferslim
Downloading/unpacking waferslim
Could not find any downloads that satisfy the requirement waferslim
Cleaning up...
No distributions at all found for waferslim
But if I try installing it with easy_install, it is installed correctly. Why does this happen? Is there a way I can install it using Pip instead of easy_install? I wrote a requirements.txt file that holds all the dependencies for my project, but running pip install -r requirements.txt fails because of waferslim.

Categories

Resources