I have been trying to deploy a python script to Iron.io. They recommend using docker to test locally before uploading.
I have completed their provided docker/iron tutorial without error.
So I started to modify the provided requirements.txt from their sample repo to start my own project, but whenever I try to install the packages locally I receive a TypeError.
My pip is version:
pip 7.1.2 from /Library/Python/2.7/site-packages (python 2.7)
Their requirements.txt
iron-mq>=0.5
iron-worker>=1.3.1
My requirements.txt
iron-mq>=0.5
iron-worker>=1.3.1
beautifulsoup4
html5lib
Terminal command:
$ docker run --rm -v "$PWD":/worker -w /worker iron/python:2-dev pip install -t packages -r requirements.txt
Error:
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 282, in run
wheel_cache
File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 291, in populate_requirement_set
wheel_cache=wheel_cache):
File "/usr/lib/python2.7/site-packages/pip/req/req_file.py", line 89, in parse_requirements
for req in req_iter:
File "/usr/lib/python2.7/site-packages/pip/req/req_file.py", line 137, in process_line
isolated=isolated, options=req_options, wheel_cache=wheel_cache
File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 168, in from_line
if (os.path.isdir(p) and
File "/usr/lib/python2.7/genericpath.py", line 49, in isdir
st = os.stat(s)
TypeError: must be encoded string without NULL bytes, not str
I am using Sublime on OSX and encoding with UTF-8. Other threads regarding this error are usually resolved by escaping some characters or changing the encoding. But I couldn't find an alternative encoding to use.
Is there a trick to saving requirements without any null bytes? Or is there another known fix?
Edit update:
Running with -vvv max verbose mode for pip
docker run --rm -v "$PWD":/worker -w /worker iron/python:2-dev pip install -vvv -t packages -r requirements.txt
Returned
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 282, in run
wheel_cache
File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 291, in populate_requirement_set
wheel_cache=wheel_cache):
File "/usr/lib/python2.7/site-packages/pip/req/req_file.py", line 89, in parse_requirements
for req in req_iter:
File "/usr/lib/python2.7/site-packages/pip/req/req_file.py", line 137, in process_line
isolated=isolated, options=req_options, wheel_cache=wheel_cache
File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 168, in from_line
if (os.path.isdir(p) and
File "/usr/lib/python2.7/genericpath.py", line 49, in isdir
st = os.stat(s)
TypeError: must be encoded string without NULL bytes, not str
Starting new HTTPS connection (1): pypi.python.org
"GET /pypi/pip/json HTTP/1.1" 200 50975
The only new output was the two lines at the bottom.
Running iconv to identify any rogue characters just returns the contents of the txt file.
iconv -t UTF-8 requirements.txt
iron-mq>=0.5
iron-worker>=1.3.1
beautifulsoup4==4.4.1