Error while running requirement.txt - python

I am trying to create requirement.txt for my Django project. I went through https://pip.readthedocs.org/en/1.1/requirements.html and accordingly trying to my requirement.txt
Django==1.8.4
django-autocomplete-light
django-cors-headers
django-watson
django-filter
django-import-export
MySQL-python
Pillow
jsonpickle
mysql-connector-python --allow-external mysql-connector-python
python-amazon-product-api
lxml
similarityPy
coverage
django-redis-cache
redis
django-debreach
Error which I am getting is:
------------------------------------------------------------
/usr/bin/pip run on Mon Dec 7 20:36:32 2015
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 262, in run
for req in parse_requirements(filename, finder=finder, options=options, session=session):
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1632, in parse_requirements
req = InstallRequirement.from_line(line, comes_from, prereleases=getattr(options, "pre", None))
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 173, in from_line
return cls(req, comes_from, url=url, prereleases=prereleases)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 71, in __init__
req = pkg_resources.Requirement.parse(req)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2667, in parse
reqs = list(parse_requirements(s))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2605, in parse_requirements
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2573, in scan_list
raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', 'mysql-connector-python --allow-external mysql-connector-python', 'at', ' --allow-external mysql-connector-python')
What am I missing here ?

This line is not valid in a requirements.txt file:
mysql-connector-python --allow-external mysql-connector-python
I think the format for doing this would be:
--allow-external mysql-connector-python
mysql-connector-python
i.e. something like --allow-external mysql-connector-python, which would be a command-line arg to pip itself, should appear on its own line
https://pip.readthedocs.org/en/stable/reference/pip_install/#requirements-file-format
This is also invalid (!) in a pip requirements file:
apt-get install redis-server

Related

How does one pip install torch 1.9.x with cuda 11.1 when errors related with memory issue arise?

I was trying to install torch 1.9.x with pip3 but I get this error:
(metalearning_gpu) miranda9~/automl-meta-learning $ pip3 install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch==1.9.0+cu111
ERROR: Exception:
Traceback (most recent call last):
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 173, in _main
status = self.run(options, args)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 203, in wrapper
return func(self, options, args)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 315, in run
requirement_set = resolver.resolve(
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 94, in resolve
result = self._result = resolver.resolve(
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 472, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 341, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 172, in _add_to_criteria
if not criterion.candidates:
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_vendor/resolvelib/structs.py", line 151, in __bool__
return bool(self._sequence)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 140, in __bool__
return any(self)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 128, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 32, in _iter_built
candidate = func()
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 204, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 295, in __init__
super().__init__(
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 156, in __init__
self.dist = self._prepare()
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 227, in _prepare
dist = self._prepare_distribution()
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 305, in _prepare_distribution
return self._factory.preparer.prepare_linked_requirement(
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 508, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 550, in _prepare_linked_requirement
local_file = unpack_url(
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 239, in unpack_url
file = get_http_url(
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 102, in get_http_url
from_path, content_type = download(link, temp_dir.path)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/network/download.py", line 132, in __call__
resp = _http_get_download(self._session, link)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/network/download.py", line 115, in _http_get_download
resp = session.get(target_url, headers=HEADERS, stream=True)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_vendor/requests/sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/network/session.py", line 454, in request
return super().request(method, url, *args, **kwargs)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_vendor/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_vendor/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_vendor/cachecontrol/adapter.py", line 44, in send
cached_response = self.controller.cached_request(request)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_vendor/cachecontrol/controller.py", line 139, in cached_request
cache_data = self.cache.get(cache_url)
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/pip/_internal/network/cache.py", line 54, in get
return f.read()
MemoryError
It says there is a memory error but I don't understand where and how? How do I start debugging this?
Nothing in my home seems like a problem:
(metalearning_gpu) miranda9~/automl-meta-learning $ du -hs ~
150G /home/miranda9
Not sure why this is the case but it seems once I got a node to run the installs (with a gpu) the install worked...is that normal?!
(synthesis) miranda9~/automl-meta-learning $ condor_submit -i interactive.sub
Submitting job(s).
1 job(s) submitted to cluster 17192.
Could not find conda environment: metalearning_cpu
You can list all discoverable environments with `conda info --envs`.
Welcome to slot1_1#vision-02.cs.illinois.edu!
Could not find conda environment: metalearning_cpu
You can list all discoverable environments with `conda info --envs`.
(synthesis) miranda9~/automl-meta-learning $
(synthesis) miranda9~/automl-meta-learning $
(synthesis) miranda9~/automl-meta-learning $
(synthesis) miranda9~/automl-meta-learning $
(synthesis) miranda9~/automl-meta-learning $
(synthesis) miranda9~/automl-meta-learning $ conda activate metalearning_gpu
(metalearning_gpu) miranda9~/automl-meta-learning $ pip3 install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch==1.9.0+cu111
Using cached https://download.pytorch.org/whl/cu111/torch-1.9.0%2Bcu111-cp39-cp39-linux_x86_64.whl (2041.4 MB)
Collecting torchvision==0.10.0+cu111
Using cached https://download.pytorch.org/whl/cu111/torchvision-0.10.0%2Bcu111-cp39-cp39-linux_x86_64.whl (23.1 MB)
Collecting torchaudio==0.9.0
Using cached torchaudio-0.9.0-cp39-cp39-manylinux1_x86_64.whl (1.9 MB)
Collecting typing-extensions
Using cached typing_extensions-3.10.0.2-py3-none-any.whl (26 kB)
Collecting numpy
Using cached numpy-1.21.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.8 MB)
Collecting pillow>=5.3.0
Using cached Pillow-8.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB)
Installing collected packages: typing-extensions, torch, pillow, numpy, torchvision, torchaudio
Successfully installed numpy-1.21.2 pillow-8.3.2 torch-1.9.0+cu111 torchaudio-0.9.0 torchvision-0.10.0+cu111 typing-extensions-3.10.0.2
(metalearning_gpu) miranda9~/automl-meta-learning $
you might want to try this command instead:
pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html
you could try to add --no-cache-dir at the end in order to avoid RAM issues

How to install tensorflow?

I am having some difficulties in installing TensorFlow on my computer.
My OS: Windows 8
My Python version: 3.7 (64-bit)
I used pip install Tensorflow
https://www.tensorflow.org/install/pip
Should I copy its commands to cmd? Or I should change some details of them accordingly?
For example:
I tried running code:
pip3 install -U pip virtualenv
Here is what I get:
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Users\A>virtualenv --system-site-packages -p python3 ./venv
The path python3 (from --python=python3) does not exist
What does it mean by "the path does not exist"? I tried changing "python3 ." to "python3.7 .", but it doesn't work out.
Even tho the first command didn't work out, it seems the pip, python, and virtualenv are installed on my PC.
Here is the issue I have when I try to download Tensorflow:
I tried running code:
pip install --upgrade tensorflow
This is the error:
C:\Users\A>.\venv\Scripts\activate
The system cannot find the path specified.
C:\Users\A>pip install --upgrade pip
Requirement already up-to-date: pip in c:\users\a\appdata\local\programs\python\
python37\lib\site-packages (20.0.2)
C:\Users\A>
C:\Users\A>pip list # show packages installed within the virtual environment
Package Version
---------- -------
pip 20.0.2
setuptools 45.1.0
virtualenv 16.7.9
wheel 0.34.2
C:\Users\A>pip install --upgrade tensorflow
Collecting tensorflow
Downloading tensorflow-2.1.0-cp37-cp37m-win_amd64.whl (355.8 MB)
| | 788 kB 3.2 kB/s eta 1 day, 6:26:40ERROR:
Exception:
Traceback (most recent call last):
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_vendor\urllib3\response.py", line 425, in _error_catcher
yield
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_vendor\urllib3\response.py", line 507, in read
data = self._fp.read(amt) if not fp_closed else b""
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_vendor\cachecontrol\filewrapper.py", line 62, in read
data = self.__fp.read(amt)
File "c:\users\a\appdata\local\programs\python\python37\lib\http\client.py", l
ine 457, in read
n = self.readinto(b)
File "c:\users\a\appdata\local\programs\python\python37\lib\http\client.py", l
ine 501, in readinto
n = self.fp.readinto(b)
File "c:\users\a\appdata\local\programs\python\python37\lib\socket.py", line 5
89, in readinto
return self._sock.recv_into(b)
File "c:\users\a\appdata\local\programs\python\python37\lib\ssl.py", line 1071
, in recv_into
return self.read(nbytes, buffer)
File "c:\users\a\appdata\local\programs\python\python37\lib\ssl.py", line 929,
in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\cli\base_command.py", line 186, in _main
status = self.run(options, args)
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\commands\install.py", line 331, in run
resolver.resolve(requirement_set)
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\legacy_resolve.py", line 177, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\legacy_resolve.py", line 333, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\legacy_resolve.py", line 282, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(req)
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\operations\prepare.py", line 482, in prepare_linked_requirement
hashes=hashes,
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\operations\prepare.py", line 287, in unpack_url
hashes=hashes,
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\operations\prepare.py", line 159, in unpack_http_url
link, downloader, temp_dir.path, hashes
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\operations\prepare.py", line 303, in _download_http_url
for chunk in download.chunks:
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\utils\ui.py", line 160, in iter
for x in it:
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\network\utils.py", line 39, in response_chunks
decode_content=False,
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_vendor\urllib3\response.py", line 564, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_vendor\urllib3\response.py", line 529, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "c:\users\a\appdata\local\programs\python\python37\lib\contextlib.py", li
ne 130, in __exit__
self.gen.throw(type, value, traceback)
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_vendor\urllib3\response.py", line 430, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files
.pythonhosted.org', port=443): Read timed out.
C:\Users\A>https://github.com/tensorflow/tensorflow/issues/5949
How can I install Tensorflow? Thank you!
Update 1:
When I change 'python 3' to 'python', and 'pip3' to 'pip', the first few command lines work out.
However, I still can't download Tensorflow.
A bit more has been downloaded this time:
(venv) C:\Users\A> pip install --upgrade tensorflow
Collecting tensorflow
Downloading tensorflow-2.1.0-cp37-cp37m-win_amd64.whl (355.8 MB)
|█ | 8.4 MB 10.0 kB/s eta 9:40:28ERROR: Exce
ption:
Traceback (most recent call last):
File "c:\users\a\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line
425, in _error_catcher
yield
File "c:\users\a\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line
507, in read
data = self._fp.read(amt) if not fp_closed else b""
File "c:\users\a\venv\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.p
y", line 62, in read
data = self.__fp.read(amt)
File "C:\Users\A\AppData\Local\Programs\Python\Python37\Lib\http\client.py", l
ine 457, in read
n = self.readinto(b)
File "C:\Users\A\AppData\Local\Programs\Python\Python37\Lib\http\client.py", l
ine 501, in readinto
n = self.fp.readinto(b)
File "C:\Users\A\AppData\Local\Programs\Python\Python37\Lib\socket.py", line 5
89, in readinto
return self._sock.recv_into(b)
File "C:\Users\A\AppData\Local\Programs\Python\Python37\Lib\ssl.py", line 1071
, in recv_into
return self.read(nbytes, buffer)
File "C:\Users\A\AppData\Local\Programs\Python\Python37\Lib\ssl.py", line 929,
in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\a\venv\lib\site-packages\pip\_internal\cli\base_command.py", li
ne 186, in _main
status = self.run(options, args)
File "c:\users\a\venv\lib\site-packages\pip\_internal\commands\install.py", li
ne 331, in run
resolver.resolve(requirement_set)
File "c:\users\a\venv\lib\site-packages\pip\_internal\legacy_resolve.py", line
177, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "c:\users\a\venv\lib\site-packages\pip\_internal\legacy_resolve.py", line
333, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "c:\users\a\venv\lib\site-packages\pip\_internal\legacy_resolve.py", line
282, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(req)
File "c:\users\a\venv\lib\site-packages\pip\_internal\operations\prepare.py",
line 482, in prepare_linked_requirement
hashes=hashes,
File "c:\users\a\venv\lib\site-packages\pip\_internal\operations\prepare.py",
line 287, in unpack_url
hashes=hashes,
File "c:\users\a\venv\lib\site-packages\pip\_internal\operations\prepare.py",
line 159, in unpack_http_url
link, downloader, temp_dir.path, hashes
File "c:\users\a\venv\lib\site-packages\pip\_internal\operations\prepare.py",
line 303, in _download_http_url
for chunk in download.chunks:
File "c:\users\a\venv\lib\site-packages\pip\_internal\utils\ui.py", line 160,
in iter
for x in it:
File "c:\users\a\venv\lib\site-packages\pip\_internal\network\utils.py", line
39, in response_chunks
decode_content=False,
File "c:\users\a\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line
564, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "c:\users\a\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line
529, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "C:\Users\A\AppData\Local\Programs\Python\Python37\Lib\contextlib.py", li
ne 130, in __exit__
self.gen.throw(type, value, traceback)
File "c:\users\a\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line
430, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files
.pythonhosted.org', port=443): Read timed out.
(venv) C:\Users\A>
Update 2:
I used the following command line:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow
Much more was downloaded.
Here is the new error:
ERROR: Could not find a version that satisfies the requirement tensorboard<2.2.0
,>=2.1.0 (from tensorflow) (from versions: 1.6.0rc0, 1.6.0, 1.7.0, 1.8.0, 1.9.0,
1.10.0, 1.11.0, 1.12.0, 1.12.1, 1.12.2, 1.13.0, 1.13.1, 1.14.0, 1.15.0, 2.0.0,
2.0.1, 2.0.2)
ERROR: No matching distribution found for tensorboard<2.2.0,>=2.1.0 (from tensor
flow)
C:\Users\A>
Do I need a different version of Tensorflow?
Use below commands to install TensorFlow inside virtual environment.
1) upgrade pip3:
python3 -m pip install --upgrade pip
2) Install virtual env
pip3 install virtualenv
3) You can then create a virtualenv using the full path of python3 like this:
virtualenv -p /home/example_username/opt/python-3.6.2/bin/python3 venv
4) Activate virtual env
source venv/bin/activate
5) install tensorflow
pip3 install tensorflow
please note this error message.
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files
.pythonhosted.org', port=443): Read timed out.
It seems that you can't connect to files.pythonhosted.org. You can visit this url: https://pypi.org/project/tensorflow/#files to down tensorflow-2.1.0-cp37-cp37m-win_amd64.whl first. And then use pip install <name>.whl to install it.
More:
If you are in China, you can use bellow command to install tensorflow from tsinghua University.
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow

raise ValueError("Expected "+item_name+" in",line,"at",line[p:]) ValueError: ('Expected version spec in', 'django~=1.9.0', 'at', '~=1.9.0')

I am following this tutorial on Windows 7 with Python 3. However I get this error:
PS C:\Users\jalal> C:/Python34/python -m pip install django~=1.9.0
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 run
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', 'django~=1.9.0', 'at', '~=1.9.0')
Storing debug log for failure in C:\Users\jalal\pip\pip.log
PS C:\Users\jalal> pip -v
The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
g of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:4
+ pip <<<< -v
+ CategoryInfo : ObjectNotFound: (pip:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I tried it with -r flag as mentioned in an Stackoverflow response however I got this error.
PS C:\Users\jalal> C:/Python34/python -m pip install -r django~=1.9.0
Could not open requirements file: [Errno 2] No such file or directory: 'django~=1.9.0'
Storing debug log for failure in C:\Users\jalal\pip\pip.log
What's the solution to this problem?
More info:
pip 1.5.6 from C:\Users\jalal\myvenv\lib\site-packages (python 3.4)
(myvenv) PS C:\Users\jalal> pip freeze
(myvenv) PS C:\Users\jalal>
pip freeze shows nothing.
This is what I get without -r flag:
PS C:\Users\jalal> C:/Python34/python -m pip install django~=1.9.0
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 run
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', 'django~=1.9.0', 'at', '~=1.9.0')
Storing debug log for failure in C:\Users\jalal\pip\pip.log
I also tried installing pip and then using the following command but still got error:
PS C:\Users\jalal> myvenv\Scripts\activate
(myvenv) PS C:\Users\jalal> pip install django~=1.9.0
Exception:
Traceback (most recent call last):
File "C:\Users\jalal\myvenv\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Users\jalal\myvenv\lib\site-packages\pip\commands\install.py", line 257, in run
InstallRequirement.from_line(name, None))
File "C:\Users\jalal\myvenv\lib\site-packages\pip\req.py", line 172, in from_line
return cls(req, comes_from, url=url, prereleases=prereleases)
File "C:\Users\jalal\myvenv\lib\site-packages\pip\req.py", line 70, in __init__
req = pkg_resources.Requirement.parse(req)
File "C:\Users\jalal\myvenv\lib\site-packages\pip\_vendor\pkg_resources.py", line 2667, in parse
reqs = list(parse_requirements(s))
File "C:\Users\jalal\myvenv\lib\site-packages\pip\_vendor\pkg_resources.py", line 2605, in parse_requireme
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
File "C:\Users\jalal\myvenv\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', 'django~=1.9.0', 'at', '~=1.9.0')
Storing debug log for failure in C:\Users\jalal\pip\pip.log
(myvenv) PS C:\Users\jalal>
It appears that version (1.5.6) of pip does not recognize the compatible release specifier ~=.
You can try the following version specifications which are equivalent to ~=1.9.0:
pip install django>=1.9.0
Or:
pip install django==1.9.*
In any case, you may also want to upgrade to the latest version of pip using:
pip install --upgrade pip
Do away with -r unless you are reading from a file. Use:
C:/Python34/python -m pip install django~=1.9.0

For Python can't get 'pip install -r requirements.txt' to work

I ran pip install -r requirements.txt to install my one package but no good. I repeatedly get the below error log.
Anyone know how I can fix this?
------------------------------------------------------------
C:\flask\venv\Scripts\pip run on 05/09/14 20:20:55
Exception:
Traceback (most recent call last):
File "C:\flask\venv\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\flask\venv\lib\site-packages\pip\commands\install.py", line 262, in run
for req in parse_requirements(filename, finder=finder, options=options, session=session):
File "C:\flask\venv\lib\site-packages\pip\req.py", line 1631, in parse_requirements
req = InstallRequirement.from_line(line, comes_from, prereleases=getattr(options, "pre", None))
File "C:\flask\venv\lib\site-packages\pip\req.py", line 172, in from_line
return cls(req, comes_from, url=url, prereleases=prereleases)
File "C:\flask\venv\lib\site-packages\pip\req.py", line 70, in __init__
req = pkg_resources.Requirement.parse(req)
File "C:\flask\venv\lib\site-packages\pip\_vendor\pkg_resources.py", line 2667, in parse
reqs = list(parse_requirements(s))
File "C:\flask\venv\lib\site-packages\pip\_vendor\pkg_resources.py", line 2593, in parse_requirements
raise ValueError("Missing distribution spec", line)
ValueError: ('Missing distribution spec', '\xff\xfef\x00l\x00a\x00s\x00k\x00')
I figured it out. Windows saved the requirements.txt file to Unicode by default. Saving the file to ansi fixed the issue.

python 3 pip install non-ASCII payload error

Using python3.4 w/ pip trying to install django-floppyforms==1.1 and got this non-ASCII payload error. I don't get this error with python2.7. What's going on?
Downloading/unpacking django-floppyforms==1.1 (from -r ../requirements/base.txt (line 22))
Downloading django_floppyforms-1.1-py33-none-any.whl (51kB): 51kB downloaded
Cleaning up...
Exception:
Traceback (most recent call last):
File "/home/admin/.virtualenvs/py3/lib/python3.4/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/home/admin/.virtualenvs/py3/lib/python3.4/site-packages/pip/commands/install.py", line 274, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/home/admin/.virtualenvs/py3/lib/python3.4/site-packages/pip/req.py", line 1206, in prepare_files
for subreq in dist.requires(req_to_install.extras):
File "/home/admin/.virtualenvs/py3/lib/python3.4/site-packages/pip/_vendor/pkg_resources.py", line 2236, in requires
dm = self._dep_map
File "/home/admin/.virtualenvs/py3/lib/python3.4/site-packages/pip/_vendor/pkg_resources.py", line 2429, in _dep_map
self.__dep_map = self._compute_dependencies()
File "/home/admin/.virtualenvs/py3/lib/python3.4/site-packages/pip/_vendor/pkg_resources.py", line 2451, in _compute_dependencies
for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
File "/home/admin/.virtualenvs/py3/lib/python3.4/site-packages/pip/_vendor/pkg_resources.py", line 2421, in _parsed_pkg_info
self._pkg_info = Parser().parsestr(self.get_metadata(self.PKG_INFO))
File "/usr/local/lib/python3.4/email/parser.py", line 70, in parsestr
return self.parse(StringIO(text), headersonly=headersonly)
File "/usr/local/lib/python3.4/email/parser.py", line 60, in parse
return feedparser.close()
File "/usr/local/lib/python3.4/email/feedparser.py", line 170, in close
self._call_parse()
File "/usr/local/lib/python3.4/email/feedparser.py", line 163, in _call_parse
self._parse()
File "/usr/local/lib/python3.4/email/feedparser.py", line 449, in _parsegen
self._cur.set_payload(EMPTYSTRING.join(lines))
File "/usr/local/lib/python3.4/email/message.py", line 311, in set_payload
" payload") from None
TypeError: charset argument must be specified when non-ASCII characters are used in the payload
Storing debug log for failure in /tmp/tmpletnstcp
This is due to a bug in Python-3.4.0b3. This bug has been fixed 2014-02-07 18:30 (http://bugs.python.org/issue20531).
You can either use Python-3.4.0rc1 or fix it by copying the email package over Python 3.4.0b3 as confirmed in http://bugs.python.org/issue20531#msg210508.
I've just tested it with Python-3.4.0rc1 on squeeze and the package was succesfully installed:
$ pip install django-floppyforms==1.1
Downloading/unpacking django-floppyforms==1.1
Downloading django_floppyforms-1.1-py33-none-any.whl (51kB): 51kB downloaded
Installing collected packages: django-floppyforms
Successfully installed django-floppyforms

Categories

Resources