pip3 crashes when installing h5py [duplicate] - python

This question already has answers here:
Pip does not work after upgrade to ubuntu-16.10
(3 answers)
Closed 5 years ago.
I am trying to install h5py and execute sudo
pip3 install h5py
I also tried to install h5py via wheel from https://pypi.python.org/pypi/h5py/2.7.0rc2
I have python 3.5 installed. And pip3 then crashes with this output:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip import main
File "/usr/local/lib/python3.5/dist-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/local/lib/python3.5/dist-packages/pip/utils/__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
#_call_aside
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
declare_namespace(pkg)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2121, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
I'm running on Ubuntu 16.04.3 LTS
I don't think pip3 is broken because I installed a lot with pip3 before.
What can I do?
Thanks a lot.

I would start by not using sudo to install, but use an virtualenv. I use virtualenvwrapper personally. Following works fine for me locally.
$ mkvirtualenv bla --python=python3 # Random naming
# Env is activated right away
$ pip3 install h5py
Collecting h5py
Downloading h5py-2.7.1-cp35-cp35m-manylinux1_x86_64.whl (5.3MB)
100% |████████████████████████████████| 5.3MB 340kB/s
Collecting six (from h5py)
Using cached six-1.11.0-py2.py3-none-any.whl
Collecting numpy>=1.7 (from h5py)
Downloading numpy-1.14.0-cp35-cp35m-manylinux1_x86_64.whl (17.1MB)
100% |████████████████████████████████| 17.1MB 118kB/s
Installing collected packages: six, numpy, h5py
Successfully installed h5py-2.7.1 numpy-1.14.0 six-1.11.0

Related

error occurred when 'pip install google-cloud-speech'

Thanks for reading.
I do need your help.
I wanted to install google-cloud-speech, so I typed
'pip install google-cloud-speech'
in cmd.exe(Windows 10)
but error occured.
Is there any proper way to solve this, please let me know it.
Thanks.
Collecting google-cloud-speech
Using cached google_cloud_speech-0.32.0-py2.py3-none-any.whl
Collecting requests<3.0dev,>=2.18.4 (from google-cloud-speech)
Using cached requests-2.18.4-py2.py3-none-any.whl
Collecting googleapis-common-protos[grpc]<2.0dev,>=1.5.2 (from google-cloud-speech)
Using cached googleapis-common-protos-1.5.3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\developer\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\__init__.py", line 10, in <module>
from setuptools.extern.six.moves import filter, filterfalse, map
File "c:\users\developer\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\extern\__init__.py", line 1, in <module>
from pkg_resources.extern import VendorImporter
File "c:\users\developer\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 3017, in <module>
#_call_aside
File "c:\users\developer\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 3003, in _call_aside
f(*args, **kwargs)
File "c:\users\developer\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 3045, in _initialize_master_working_set
dist.activate(replace=False)
File "c:\users\developer\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2577, in activate
declare_namespace(pkg)
File "c:\users\developer\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2151, in declare_namespace
_handle_ns(packageName, path_item)
File "c:\users\developer\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2091, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "c:\users\developer\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2120, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\DEVELO~1\AppData\Local\Temp\pip-build-91vxtz3t\googleapis-common-protos\
I had the same problem as you and found a solution on the Google Platform Git.
In my case, it was because pip was not up-to-date. Just do :
pip install --upgrade pip
pip install --upgrade setuptools
pip install google-cloud

Unable to use pip3 to install packages

Hey guys I think my pip3 has just hit a snag. Can somebody help me with this.
I ran this command:
pip3 install tensorflow
And it gave this as an output:
This output is not only with tensorflow package but with any package i try to install with pip3.
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/home/het/.local/lib/python3.5/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/home/het/.local/lib/python3.5/site-packages/pip/utils/__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "/home/het/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
#_call_aside
File "/home/het/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "/home/het/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "/home/het/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
declare_namespace(pkg)
File "/home/het/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/het/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/home/het/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2121, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
What can be the reason
Edit: pip works just fine but pip3 doesn't work
Try update pip and setuptools
pip3 install --upgrade pip setuptools
Also, the best way is using virtualenv
You are using the wrong syntax. Just try pip install tensorflow in command prompt and everything should run smoothly. I tried at my end and it worked. Refer attached image. See the first few lines and the last few lines.

Pylint installation failed on windows

I tried to install pylint on windows (using visual studio code). I have this exception, I can't find a solution.
I already tried to completely reinstall python but I have the exact same error.
On other PC, the same repro step works fine.
>"C:\Program Files (x86)\Python36-32\python" -m pip install pylint
Collecting pylint
Downloading pylint-1.7.2-py2.py3-none-any.whl (644kB)
100% |████████████████████████████████| 645kB 1.9MB/s
Collecting colorama; sys_platform == "win32" (from pylint)
Downloading colorama-0.3.9-py2.py3-none-any.whl
Collecting astroid>=1.5.1 (from pylint)
Downloading astroid-1.5.3-py2.py3-none-any.whl (269kB)
100% |████████████████████████████████| 276kB 4.1MB/s
Collecting isort>=4.2.5 (from pylint)
Downloading isort-4.2.15-py2.py3-none-any.whl (43kB)
100% |████████████████████████████████| 51kB 5.7MB/s
Collecting mccabe (from pylint)
Downloading mccabe-0.6.1-py2.py3-none-any.whl
Collecting six (from pylint)
Downloading six-1.10.0-py2.py3-none-any.whl
Collecting lazy-object-proxy (from astroid>=1.5.1->pylint)
Downloading lazy_object_proxy-1.3.1-cp36-cp36m-win32.whl
Collecting wrapt (from astroid>=1.5.1->pylint)
Downloading wrapt-1.10.11.tar.gz
Installing collected packages: colorama, six, lazy-object-proxy, wrapt, astroid, isort, mccabe, pylint
Running setup.py install for wrapt ... error
Exception:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 5: invalid continuation byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pip\req\req_install.py", line 878, in install
spinner=spinner,
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
line = console_to_str(proc.stdout.readline())
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 5: invalid continuation byte
Do you have any what the problem could be?
EDIT:
As Shankar said, I installed astroid manually. It didn't work the first time. I encountered this issue: python easy_install pylint Error: The system cannot find the file specified
The installation finally worked but nothing changed for pylint.
Here is the log I receive when I try to run pylint
Traceback (most recent call last):
File "c:\program files (x86)\python36-32\lib\runpy.py", line 193, in _run_modu
le_as_main
"__main__", mod_spec)
File "c:\program files (x86)\python36-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files (x86)\Python36-32\Scripts\pylint.exe\__main__.py", line
9, in <module>
File "c:\program files (x86)\python36-32\lib\site-packages\pylint\__init__.py"
, line 12, in run_pylint
from pylint.lint import Run
File "c:\program files (x86)\python36-32\lib\site-packages\pylint\lint.py", li
ne 43, in <module>
import astroid
File "c:\program files (x86)\python36-32\lib\site-packages\astroid\__init__.py
", line 57, in <module>
from astroid.nodes import *
File "c:\program files (x86)\python36-32\lib\site-packages\astroid\nodes.py",
line 30, in <module>
from astroid.node_classes import (
File "c:\program files (x86)\python36-32\lib\site-packages\astroid\node_classe
s.py", line 26, in <module>
from astroid import decorators
File "c:\program files (x86)\python36-32\lib\site-packages\astroid\decorators.
py", line 12, in <module>
import wrapt
File "c:\program files (x86)\python36-32\lib\site-packages\wrapt\__init__.py",
line 4, in <module>
from .wrappers import (ObjectProxy, CallableObjectProxy, FunctionWrapper,
ModuleNotFoundError: No module named 'wrapt.wrappers'
Thanks
Install
Pylint requires astroid package (the later the better).
https://github.com/PyCQA/astroid
Installation should be as simple as
python -m pip install astroid
Pylint requires isort package (the later the better).
https://github.com/timothycrosley/isort
Installation should be as simple as
python -m pip install isort
If you want to install from a source distribution, extract the tarball and run the following commands
python setup.py install
You’ll have to install dependencies in a similar way. For debian and rpm packages, use your usual tools according to your Linux distribution.
More information about installation and available distribution format may be found in the user manual in the doc subdirectory.
After these two dependencies installed , try installing pylint again.

Can't install packages in Windows 10

I just reinstalled Python 3.6, but when I try to install packages, Windows returns errors. First I tried installing package BeautifulSoup from the Windows command prompt:
python -m pip install BeautifulSoup
but this returns the following error:
Collecting BeautifulSoup
Using cached BeautifulSoup-3.2.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Robert\AppData\Local\Temp\pip-build-iiyyxs2o\BeautifulSoup\setup.py", line 22
print "Unit tests have failed!"
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Robert\AppData\Local\Temp\pip-build-iiyyxs2o\BeautifulSoup\
Then I tried installing package requests:
python -m pip install requests
but this returns
C:\Program Files\Python36>python -m pip install requests
Collecting requests
Using cached requests-2.18.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests)
Using cached certifi-2017.7.27.1-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests)
Using cached idna-2.6-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests)
Using cached chardet-3.0.4-py2.py3-none-any.whl
Collecting urllib3<1.23,>=1.21.1 (from requests)
Using cached urllib3-1.22-py2.py3-none-any.whl
Installing collected packages: certifi, idna, chardet, urllib3, requests
Exception:
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Program Files\Python36\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "C:\Program Files\Python36\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "C:\Program Files\Python36\lib\site-packages\pip\wheel.py", line 316, in clobber
ensure_dir(destdir)
File "C:\Program Files\Python36\lib\site-packages\pip\utils\__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "C:\Program Files\Python36\lib\os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [WinError 5] Access is denied: 'C:\\Program Files\\Python36\\Lib\\site-packages\\certifi'
What do I need to do so that pip successfully installs packages?
BeautifulSoup is for Python 2 only. For Python 3 install beautifulsoup4:
pip install beautifulsoup4
The second problem seems obvious: you don't have write-access to C:\\Program Files\\Python36\\Lib\\site-packages and subdirectories.

scrapy startproject tutorial: Error when I execute this command

C:\Windows\system32>scrapy startproject tutorial
Traceback (most recent call last):
File "C:\Python34\Scripts\scrapy-script.py", line 9, in <module>
load_entry_point('Scrapy==0.24.4', 'console_scripts', 'scrapy')()
File "C:\Python34\lib\site-packages\pkg_resources.py", line 353, in load_entry
_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python34\lib\site-packages\pkg_resources.py", line 2302, in load_entr
y_point
return ep.load()
File "C:\Python34\lib\site-packages\pkg_resources.py", line 2029, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "C:\Python34\lib\site-packages\scrapy\__init__.py", line 28, in <module>
import _monkeypatches
ImportError: No module named '_monkeypatches'
I'm a newbie in scrapy & python. I was trying to create a scrapy project but wasn't able to. I have installed pip, setuptools, lxml and scrapy.
C:\Windows\system32>pip list
cffi (0.8.6)
cryptography (0.5.4)
cssselect (0.9.1)
lxml (3.4.0)
pip (1.5.6)
pycparser (2.10)
pyOpenSSL (0.14)
queuelib (1.2.2)
Scrapy (0.24.4)
setuptools (2.1)
six (1.8.0)
Twisted (14.0.2)
w3lib (1.10.0)
zope.interface (4.1.1)
Please help! I've been searching around but still couldn't find a solution.
Scrapy is supported under Python 2.7 only at the moment. You'll need to install 2.7 for this to work.

Categories