Cannot install Tensorflow in Python - python

I'm running python 3.5.3 on Windows
I tried using
pip install --upgrade tensorflow
and here's what i get back
Using cached tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
Requirement already up-to-date: wheel>=0.26 in
c:\users\max\miniconda3\lib\site-packages (from tensorflow)
Exception:
Traceback (most recent call last):
File "C:\Users\Max\Miniconda3\lib\site-packages\pip\basecommand.py", line
215, in main
status = self.run(options, args)
File "C:\Users\Max\Miniconda3\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Users\Max\Miniconda3\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Users\Max\Miniconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\Max\Miniconda3\lib\site-packages\pip\req\req_set.py", line 666, in _prepare_file
check_dist_requires_python(dist)
File "C:\Users\Max\Miniconda3\lib\site-packages\pip\utils\packaging.py", line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File "C:\Users\Max\Miniconda3\lib\email\feedparser.py", line 178, in feed
self._input.push(data)
File "C:\Users\Max\Miniconda3\lib\email\feedparser.py", line 104, in push
self._partial.write(data)
TypeError: string argument expected, got 'NoneType'
I've also tried
pip3 install --upgrade tensorflow
but I get back
'pip3' is not recognized as an internal or external command, operable program or batch file.
I'm not too sure what the error is, and googling hasn't gotten me any results

I also had the same issue. I'm using Anaconda, and I managed to install it with these commands:
conda create -n tensorflow
activate tensorflow
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
This worked for me, and probably this will work for miniconda too.

Related

pip errors No files/directories in /tmp/

I am getting No files/directories in /tmp/* errors while I try to install any package on my Ubuntu 18.04.2 LTS/ Python 3.6.8 / Python 2.7.15+ machine.
For instance,
pip install pyx
Collecting pyx
Using cached https://files.pythonhosted.org/packages/f7/25/59c136568c1b61ee087155c874fcd9f7196a943a6a5ee3429efeb30ea2a8/PyX-0.15.tar.gz
No files/directories in /tmp/pip-build-nRurCC/pyx/pip-egg-info (from PKG-INFO)
This happens for every package I am trying to install.
sudo is not helping.
Solution presented here, using --no-cache-dir option, is not helping.
Output of running the pip install command with vvv option gives the following output.
No files/directories in /tmp/pip-build-VU1cex/pyx/pip-egg-info (from PKG-INFO)
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 342, in run
requirement_set.prepare_files(finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 455, in run_egg_info
metadata_name = canonicalize_name(self.pkg_info()["Name"])
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 533, in pkg_info
data = self.egg_info_data('PKG-INFO')
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 471, in egg_info_data
filename = self.egg_info_path(filename)
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 515, in egg_info_path
'No files/directories in %s (from %s)' % (base, filename)
InstallationError: No files/directories in /tmp/pip-build-VU1cex/pyx/pip-egg-info (from PKG-INFO)
I think it is an upstream issue I tried multiple things even installing using the latest commit pip install git+https://github.com/pyx-project/pyx.git#fc66c078727b02693b122ad346b9fa5472e06eb7, please try this version: pip install PyX==0.12 it should work.
If using pip 6.0 or newer, check if it works with the --no-cache-dir option.
You can also try to get a detailed output from pip using the -vvv argument
Source: https://stackoverflow.com/a/9510610/2542835
Apparently pip3 install x works for me. pip install x does not.

pip._vendor.pep517.wrappers.BackendUnavailable error while installing cryptography

I'm trying to install cryptography to my system, but I get this error:
WARNING: Missing build requirements in pyproject.toml for cryptography from https://files.pythonhosted.org/packages/07/ca/bc827c5e55918ad223d59d299fff92f3563476c3b00d0a9157d9c0217449/cryptography-2.6.1.tar.gz#sha256=26c821cbeb683facb966045e2064303029d572a87ee69ca5a1bf54bf55f93ca6.
WARNING: The project does not specify a build backend, and pip cannot fall back to setuptools without 'setuptools>=40.8.0' and 'wheel'.
Getting requirements to build wheel ... done
ERROR: Exception:
Traceback (most recent call last):
File "/data/packages/usr/local/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 178, in main
status = self.run(options, args)
File "/data/packages/usr/local/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 352, in run
resolver.resolve(requirement_set)
File "/data/packages/usr/local/lib/python3.6/site-packages/pip/_internal/resolve.py", line 131, in resolve
self._resolve_one(requirement_set, req)
File "/data/packages/usr/local/lib/python3.6/site-packages/pip/_internal/resolve.py", line 294, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/data/packages/usr/local/lib/python3.6/site-packages/pip/_internal/resolve.py", line 242, in _get_abstract_dist_for
self.require_hashes
File "/data/packages/usr/local/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 368, in prepare_linked_requirement
abstract_dist.prep_for_dist(finder, self.build_isolation)
File "/data/packages/usr/local/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 175, in prep_for_dist
self.install_backend_dependencies(finder=finder)
File "/data/packages/usr/local/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 123, in install_backend_dependencies
reqs = req.pep517_backend.get_requires_for_build_wheel()
File "/data/packages/usr/local/lib/python3.6/site-packages/pip/_vendor/pep517/wrappers.py", line 71, in get_requires_for_build_wheel
'config_settings': config_settings
File "/data/packages/usr/local/lib/python3.6/site-packages/pip/_vendor/pep517/wrappers.py", line 162, in _call_hook
raise BackendUnavailable
pip._vendor.pep517.wrappers.BackendUnavailable
This is my setup:
Alpine Linux 3.6.2
Python 3.6.3
pip 19.1
wheel 0.33.1
setuptools 41.0.1
Any idea what could be the problem, or how to solve it?
Thanks for the help in advance!
I did not find any uniform solution to this problem. You can try the following troubleshooting steps. one of them should work.
Upgrade the pip version.
Change the library/package version.
If you are installing from source, try a different .whl package or use tar.gz.
Use --no-use-pep517 with your pip install command (didn't work for me though, but I see it worked for some).
I got the same error with a different library and --no-use-pep517 did not help. However this did:
python -m pip install --upgrade pip

I cannot install sklearn, numpy, and scipy on Windows 10 command Prompt to use on Python 3.6

I have Python 3.6 correctly installed and have been working on Eclipse. But I cannot use the libraries. Every time I import them I get an error message:
Traceback (most recent call last):
File "C:\Users\gilbe\eclipse-workspace\python3.6\BeginnerFiles\IrisDataSet", line 1, in <module>
from sklearn import datasets
ModuleNotFoundError: No module named 'sklearn'`
When I tried installing sklearn, numpy, and scipy, I type in the following into Windows Command Prompt:
"pip install numpy", "pip install scipy", or "pip install sklearn".
However, I get an error message every time. For example:
C:\Program Files (x86)\Python36-32\Scripts>pip install sklearn
Collecting sklearn
Using cached https://files.pythonhosted.org/packages/1e/7a/dbb3be0ce9bd5c8b7e3d87328e79063f8b263b2b1bfa4774cb1147bfcd3f/sklearn-0.0.tar.gz
Collecting scikit-learn (from sklearn)
Using cached https://files.pythonhosted.org/packages/87/b7/0e7f5c0cf765cf4e1924c068e7b2e1708c93ebffde9302a57ea8f26619e9/scikit_learn-0.19.1-cp36-cp36m-win32.whl
Installing collected packages: scikit-learn, sklearn
Exception:
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 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line 316, in clobber
ensure_dir(destdir)
File "c:\program files (x86)\python36-32\lib\site-packages\pip\utils\__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "c:\program files (x86)\python36-32\lib\os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [WinError 5] Access is denied: 'c:\\program files (x86)\\python36-32\\Lib\\site-packages\\scikit_learn-0.19.1.dist-info'
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Further, when I try to upgrade the pip command using the suggested command above, I also get an error message:
C:\Program Files (x86)\Python36-32\Scripts>python -m pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Exception:
Traceback (most recent call last):
File "C:\Program Files\Inkscape\python\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Program Files\Inkscape\python\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "C:\Program Files\Inkscape\python\lib\site-packages\pip\req\req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "C:\Program Files\Inkscape\python\lib\site-packages\pip\req\req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "C:\Program Files\Inkscape\python\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
renames(path, new_path)
File "C:\Program Files\Inkscape\python\lib\site-packages\pip\utils\__init__.py", line 267, in renames
shutil.move(old, new)
File "C:\Program Files\Inkscape\python\lib\shutil.py", line 303, in move
os.unlink(src)
WindowsError: [Error 5] Access is denied: 'c:\\program files\\inkscape\\python\\lib\\site-packages\\pip-9.0.1.dist-info\\description.rst'
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
My real question here is how do I fix these issues, and install these libraries correctly, I have spent a whole day trying to fix this in different ways, including: installing the libraries from inside Eclipse, through Window>Preferences>Interpreter>Python Interpreter>Install with pip
, Uninstalling and Reinstalling Python, attempting to use the easy_install <package> command.
Please help.
right click on the windows button on bottom left of your screen.
Then go to "Windows PowerShell(Admin).
There you try your pip installs. It will definitely work. I think you don't have the admin access that is why you are seeing.
PermissionError: [WinError 5] Access is denied
Just open the cmd with admin as user.Hope this helps.

Pip is rolling back uninstall of setuptools

I am using this Ansible-Django stack to deploy my Django project to an AWS EC2 instance. It worked fine for a long time, but now suddenly, I get the error below when deploying.
It seems like there is a new setuptools build that is not properly updated.
Why does it rollback the uninstall of setuptools?
Why does it not install setuptools 36.2.2?
Specifying explicitly the version of setuptools in my requirements solves this issue, but since I am only indirectly dependent on setuptools, it should not be my responsibility to know which version to keep.
Installing collected packages: shared-django, setuptools
Found existing installation: shared-django 0.1.0
Uninstalling shared-django-0.1.0:
Successfully uninstalled shared-django-0.1.0
Running setup.py install for shared-django: started
Running setup.py install for shared-django: finished with status 'done'
Found existing installation: setuptools 36.2.0
Uninstalling setuptools-36.2.0:
Successfully uninstalled setuptools-36.2.0
Rolling back uninstall of setuptools
:stderr: Exception:
Traceback (most recent call last):
File \"/webapps/CatalogService/lib/python3.5/site-packages/pip/basecommand.py\", line 215, in main
status = self.run(options, args)
File \"/webapps/CatalogService/lib/python3.5/site-packages/pip/commands/install.py\", line 342, in run
prefix=options.prefix_path,
File \"/webapps/CatalogService/lib/python3.5/site-packages/pip/req/req_set.py\", line 784, in install
**kwargs
File \"/webapps/CatalogService/lib/python3.5/site-packages/pip/req/req_install.py\", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File \"/webapps/CatalogService/lib/python3.5/site-packages/pip/req/req_install.py\", line 1064, in move_wheel_files
isolated=self.isolated,
File \"/webapps/CatalogService/lib/python3.5/site-packages/pip/wheel.py\", line 247, in move_wheel_files
prefix=prefix,
File \"/webapps/CatalogService/lib/python3.5/site-packages/pip/locations.py\", line 140, in distutils_scheme
d = Distribution(dist_args)
File \"/webapps/CatalogService/lib/python3.5/site-packages/setuptools/dist.py\", line 365, in __init__
self._finalize_requires()
File \"/webapps/CatalogService/lib/python3.5/site-packages/setuptools/dist.py\", line 372, in _finalize_requires
if not self.install_requires:
AttributeError: 'Distribution' object has no attribute 'install_requires'
I had to ssh into the server and run
python -m pip install --upgrade -vv setuptools
and then I deployed again and it worked.

trouble with pip and easy_install to install python packages

I am going to install numpy library as a *.whl file, as numpy-1.9.2rc1+mkl- cp27-none-win32, on my Windows 7 machine...
Here is my approaches to do that, are which pip and easy_install packages...
The odd thing is that both don't work in the case of either Python 3.4 or Python 2.7...
Here are the trace of the attempts in the command prompt:
pip:
"C:\Users\Matinking\Desktop\numpy- 1.9.2rc1+
mkl-cp27-none-win32.whl" f
Exception:
Traceback (most recent call last):
File "c:\python34\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "c:\python34\lib\site-packages\pip\commands\install.py", line 257, in r
InstallRequirement.from_line(name, None))
File "c:\python34\lib\site-packages\pip\req.py", line 172, in from_line
return cls(req, comes_from, url=url, prereleases=prereleases)
File "c:\python34\lib\site-packages\pip\req.py", line 70, in __init__
req = pkg_resources.Requirement.parse(req)
File "c:\python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2667
in parse
reqs = list(parse_requirements(s))
File "c:\python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2605
in parse_requirements
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
File "c:\python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2573
in scan_list
raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', ' C:\\Users\\Matinking\\Desktop\\numer
performance.pdf', 'at', ':\\Users\\Matinking\\Desktop\\numericperformance.pdf'
Storing debug log for failure in C:\Users\Matinking\pip\pip.log
and easy_install:
C:\Python34\Scripts>easy_install.exe "C:\Users\Matinking\Desktop\numpy- 1.9.2rc1+
mkl-cp27-none-win32.whl"
Processing numpy-1.9.2rc1+mkl-cp27-none-win32.whl
Writing C:\Users\MATINK~1\AppData\Local\Temp\easy_install- jr2ijafr\numpy\setup.c
fg
Running numpy\setup.py -q bdist_egg --dist-dir C:\Users\MATINK~1\AppData\Local\T
emp\easy_install-jr2ijafr\numpy\egg-dist-tmp-umy5kseg
This is the wrong setup.py file to run
No eggs found in C:\Users\MATINK~1\AppData\Local\Temp\easy_install-jr2ijafr\nump
y\egg-dist-tmp-umy5kseg (setup script problem?)
Any idea for the problem?!
You should upgrade your pip to version 6.0, the .whl file you're using isn't compatible with earlier versions.
To bump up your pip version on Windows :
python -m pip install -U pip
pip error -> why were you running an install on a pdf? That was never going to work.
easy_install error -> looks like you downloaded a python 2.7 binary and tried to install into a python 3.4 installation.
For scientific stack python, you are hard pressed to beat an Anaconda python distribution.

Categories