Requirements.txt invalid with conda/pip on elastic beanstalk - python

Is it possible that it doesnt like the mixing of conda/pip? It says my pip is out of date, but in fact it's at 7.1.2 on my local machine.
I am trying to deploy a flask app with numpy, scipy, etc to aws
AppDeployPreHook/03deploy.py] : Activity execution failed, because: You are using pip version 7.0.3, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Exception:
Traceback (most recent call last):
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/commands/install.py", line 268, in run
wheel_cache
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/basecommand.py", line 287, in populate_requirement_set
wheel_cache=wheel_cache):
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/req/req_file.py", line 86, in parse_requirements
for req in req_iter:
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/req/req_file.py", line 130, in process_line
wheel_cache=wheel_cache
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/req/req_install.py", line 207, in from_line
wheel_cache=wheel_cache)
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/req/req_install.py", line 66, in __init__
req = pkg_resources.Requirement.parse(req)
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2960, in parse
reqs = list(parse_requirements(s))
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2904, in parse_requirements
"version spec")
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2869, in scan_list
raise ValueError(msg, line, "at", line[p:])
ValueError: ('Expected version spec in', '_license=1.1=py27_0', 'at', '=1.1=py27_0')
2015-10-16 01:37:43,439 ERROR Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 2
Traceback (most recent call last):
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
install_dependencies()
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
File "/usr/lib64/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 2 (ElasticBeanstalk::ExternalInvocationError)
caused by: You are using pip version 7.0.3, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Exception:
Traceback (most recent call last):
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/commands/install.py", line 268, in run
wheel_cache
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/basecommand.py", line 287, in populate_requirement_set
wheel_cache=wheel_cache):
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/req/req_file.py", line 86, in parse_requirements
for req in req_iter:
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/req/req_file.py", line 130, in process_line
wheel_cache=wheel_cache
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/req/req_install.py", line 207, in from_line
wheel_cache=wheel_cache)
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/req/req_install.py", line 66, in __init__
req = pkg_resources.Requirement.parse(req)
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2960, in parse
reqs = list(parse_requirements(s))
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2904, in parse_requirements
"version spec")
File "/opt/python/run/venv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2869, in scan_list
raise ValueError(msg, line, "at", line[p:])
ValueError: ('Expected version spec in', '_license=1.1=py27_0', 'at', '=1.1=py27_0')
2015-10-16 01:37:43,439 ERROR Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 2
Traceback (most recent call last):
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
install_dependencies()
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
File "/usr/lib64/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 2 (Executor::NonZeroExitStatus)
Here is my requirements file, which it says is invalid:
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-64
_license=1.1=py27_0
abstract-rendering=0.5.1=np19py27_0
alabaster=0.7.3=py27_0
anaconda=2.3.0=np19py27_0
appscript=1.0.1=py27_0
argcomplete=0.8.9=py27_0
astropy=1.0.3=np19py27_0
babel=1.3=py27_0
bcolz=0.9.0=np19py27_0
beautiful-soup=4.3.2=py27_0
binstar=0.11.0=py27_0
bitarray=0.8.1=py27_0
blaze-core=0.8.0=np19py27_0
blz=0.6.2=np19py27_1
bokeh=0.9.0=np19py27_0
boto=2.38.0=py27_0
bottleneck=1.0.0=np19py27_0
cdecimal=2.3=py27_0
certifi=14.05.14=py27_0
cffi=1.1.0=py27_0
clyent=0.3.4=py27_0
colorama=0.3.3=py27_0
configobj=5.0.6=py27_0
cryptography=0.9.1=py27_0
curl=7.43.0=0
cython=0.22.1=py27_0
cytoolz=0.7.3=py27_0
datashape=0.4.5=np19py27_0
decorator=3.4.2=py27_0
docutils=0.12=py27_0
dynd-python=0.6.5=np19py27_0
enum34=1.0.4=py27_0
fastcache=1.0.2=py27_0
flask=0.10.1=py27_1
freetype=2.5.2=2
funcsigs=0.4=py27_0
gevent=1.0.1=py27_0
gevent-websocket=0.9.3=py27_0
greenlet=0.4.7=py27_0
grin=1.2.1=py27_1
h5py=2.5.0=np19py27_3
hdf5=1.8.15.1=1
idna=2.0=py27_0
ipaddress=1.0.7=py27_0
ipython=3.2.0=py27_0
ipython-notebook=3.2.0=py27_0
ipython-qtconsole=3.2.0=py27_0
itsdangerous=0.24=py27_0
jdcal=1.0=py27_0
jedi=0.8.1=py27_0
jinja2=2.7.3=py27_1
jpeg=8d=1
jsonschema=2.4.0=py27_0
launcher=1.0.0=3
libdynd=0.6.5=0
libpng=1.6.17=0
libsodium=0.4.5=0
libtiff=4.0.2=1
libxml2=2.9.2=0
libxslt=1.1.28=2
llvmlite=0.5.0=py27_0
lxml=3.4.4=py27_0
markupsafe=0.23=py27_0
matplotlib=1.4.3=np19py27_2
mistune=0.5.1=py27_1
mock=1.0.1=py27_0
multipledispatch=0.4.7=py27_0
networkx=1.9.1=py27_0
nltk=3.0.3=np19py27_0
node-webkit=0.10.1=0
nose=1.3.7=py27_0
numba=0.19.1=np19py27_0
numexpr=2.4.3=np19py27_0
numpy=1.9.2=py27_0
odo=0.3.2=np19py27_0
openpyxl=1.8.5=py27_0
openssl=1.0.1k=1
pandas=0.16.2=np19py27_0
patsy=0.3.0=np19py27_0
pep8=1.6.2=py27_0
pillow=2.8.2=py27_0
pip=7.1.2=py27_0
ply=3.6=py27_0
psutil=2.2.1=py27_0
ptyprocess=0.4=py27_0
py=1.4.27=py27_0
pyasn1=0.1.7=py27_0
pyaudio=0.2.7=py27_0
pycosat=0.6.1=py27_0
pycparser=2.14=py27_0
pycrypto=2.6.1=py27_0
pycurl=7.19.5.1=py27_2
pyflakes=0.9.2=py27_0
pygments=2.0.2=py27_0
pyopenssl=0.15.1=py27_1
pyparsing=2.0.3=py27_0
pyqt=4.11.3=py27_0
pytables=3.2.0=np19py27_0
pytest=2.7.1=py27_0
python=2.7.10=1
python-dateutil=2.4.2=py27_0
python.app=1.2=py27_4
pytz=2015.4=py27_0
pyyaml=3.11=py27_1
pyzmq=14.7.0=py27_0
qt=4.8.6=3
readline=6.2=2
redis=2.6.9=0
redis-py=2.10.3=py27_0
requests=2.7.0=py27_0
rope=0.9.4=py27_1
runipy=0.1.3=py27_0
scikit-image=0.11.3=np19py27_0
scikit-learn=0.16.1=np19py27_0
scipy=0.15.1=np19py27_0
setuptools=18.4=py27_0
sip=4.16.5=py27_0
six=1.9.0=py27_0
snowballstemmer=1.2.0=py27_0
sockjs-tornado=1.0.1=py27_0
sphinx=1.3.1=py27_0
sphinx_rtd_theme=0.1.7=py27_0
spyder=2.3.5.2=py27_0
spyder-app=2.3.5.2=py27_0
sqlalchemy=1.0.5=py27_0
sqlite=3.8.4.1=1
ssl_match_hostname=3.4.0.2=py27_0
statsmodels=0.6.1=np19py27_0
sympy=0.7.6=py27_0
terminado=0.5=py27_0
tk=8.5.18=0
toolz=0.7.2=py27_0
tornado=4.2=py27_0
ujson=1.33=py27_0
unicodecsv=0.9.4=py27_0
werkzeug=0.10.4=py27_0
wheel=0.26.0=py27_1
xlrd=0.9.3=py27_0
xlsxwriter=0.7.3=py27_0
xlwings=0.3.5=py27_0
xlwt=1.0.0=py27_0
yaml=0.1.6=0
zeromq=4.0.5=0
zlib=1.2.8=0

Your requirements.txt file is invalid (at least for pip). If you look at the header it says;
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-64
You'll have to re-format this list for pip (remove the extra =npXYpyAB_Z blah as #mikko-ohtamaa mentioned, also rename the non-valid conda packages - _licence), or you'll need to work out how to get EBS to work from a conda environment.
Aside, you see a warning like
You are using pip version 7.0.3, however version 7.1.2 is available
it's generally best to assume it's telling the truth. Maybe you might have 7.1.2 locally, but is this script being run locally (or possibly on an EBS instance with an older pip installed...)?

Related

I don't know what is happening when is tried to upgrade pip fro 20.2.2 to 20.2.3 is showing errors

C:\Users\sulav>python get-pip.py
python: can't open file 'get-pip.py': [Errno 2] No such file or directory
C:\Users\sulav>python -m pip install -U pip
Collecting pip
Using cached pip-20.2.3-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.2.2
Uninstalling pip-20.2.2:
Successfully uninstalled pip-20.2.2
Rolling back uninstall of pip
Moving to c:\users\sulav\appdata\roaming\python\python37\scripts\pip.exe
from C:\Users\sulav\AppData\Local\Temp\pip-uninstall-plw0b_z7\pip.exe
Moving to c:\users\sulav\appdata\roaming\python\python37\scripts\pip3.7.exe
from C:\Users\sulav\AppData\Local\Temp\pip-uninstall-plw0b_z7\pip3.7.exe
Moving to c:\users\sulav\appdata\roaming\python\python37\scripts\pip3.exe
from C:\Users\sulav\AppData\Local\Temp\pip-uninstall-plw0b_z7\pip3.exe
Moving to c:\users\sulav\appdata\roaming\python\python37\site-packages\pip-20.2.2.dist-info\
from c:\users\sulav\appdata\roaming\python\python37\site-packages\~ip-20.2.2.dist-info
Moving to c:\users\sulav\appdata\roaming\python\python37\site-packages\pip\
from c:\users\sulav\appdata\roaming\python\python37\site-packages\~ip
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\sulav\AppData\Roaming\Python\Python37\site-packages\pip\_internal\cli\base_command.py", line 216, in _main
status = self.run(options, args)
File "C:\Users\sulav\AppData\Roaming\Python\Python37\site-packages\pip\_internal\cli\req_command.py", line 182, in wrapper
return func(self, options, args)
File "C:\Users\sulav\AppData\Roaming\Python\Python37\site-packages\pip\_internal\commands\install.py", line 421, in run
pycompile=options.compile,
File "C:\Users\sulav\AppData\Roaming\Python\Python37\site-packages\pip\_internal\req\__init__.py", line 90, in install_given_reqs
pycompile=pycompile,
File "C:\Users\sulav\AppData\Roaming\Python\Python37\site-packages\pip\_internal\req\req_install.py", line 821, in install
requested=self.user_supplied,
File "C:\Users\sulav\AppData\Roaming\Python\Python37\site-packages\pip\_internal\operations\install\wheel.py", line 860, in install_wheel
requested=requested,
File "C:\Users\sulav\AppData\Roaming\Python\Python37\site-packages\pip\_internal\operations\install\wheel.py", line 762, in _install_wheel
generated_console_scripts = maker.make_multiple(scripts_to_generate)
File "C:\Users\sulav\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 418, in make_multiple
filenames.extend(self.make(specification, options))
File "C:\Users\sulav\AppData\Roaming\Python\Python37\site-packages\pip\_internal\operations\install\wheel.py", line 498, in make
return super(PipScriptMaker, self).make(specification, options)
File "C:\Users\sulav\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 407, in make
self._make_script(entry, filenames, options=options)
File "C:\Users\sulav\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 307, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "C:\Users\sulav\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 242, in _write_script
launcher = self._get_launcher('t')
File "C:\Users\sulav\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 386, in _get_launcher
raise ValueError(msg)
ValueError: Unable to find resource t64.exe in package pip._vendor.distlib
WARNING: You are using pip version 20.2.2; however, version 20.2.3 is available.
You should consider upgrading via the 'C:\Users\sulav\AppData\Local\Programs\Python\Python37\python.exe -m pip install --upgrade pip' command.
You need to download get-pip.py and make sure that you are in that directory when you are trying to install it. For instance i see that the dirctory you are in is C:\Users\sulav> make sure that it is downloaded to this directory.

Buildozer How can I solve "--ndk-api=21" error

I have small app for Android that is kivy-python based. To turn it into an APK I had to use buildozer.
When I run this final step:
buildozer android debug deploy run I get this error.
I changed the NDK values in the spec files, or I changed codes. In short, what I did was looked at similar errors. I tried reported solutions and they didn't work. I don't even know what the problem is.
Related logs :
[WARNING]: Missing executable: pkg-config is not installed
[WARNING]: Missing executable: libtoolize is not installed
[INFO]: -> running autogen.sh
working: /home/abra/DeskException in thread background thread for pid 3917:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self._target(*self.args, **self._kwargs)
File "/home/abra/.local/lib/python2.7/site-packages/sh.py", line 1540, in wrap
fn(*args, **kwargs)
File "/home/abra/.local/lib/python2.7/site-packages/sh.py", line 2459, in background_thread
handle_exit_code(exit_code)
File "/home/abra/.local/lib/python2.7/site-packages/sh.py", line 2157, in fn
return self.command.handle_command_exit_code(exit_code)
File "/home/abra/.local/lib/python2.7/site-packages/sh.py", line 815, in handle_command_exit_code
raise exc
ErrorReturnCode_127:
RAN: /home/abra/Desktop/questionapp/.buildozer/android/platform/build/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/autogen.sh
STDOUT:
/home/abra/Desktop/questionapp/.buildozer/android/platform/build/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/autogen.sh: 2: exec: autoreconf: not found
STDERR:
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"_main_", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/abra/Desktop/questionapp/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1189, in <module>
main()
File "/home/abra/Desktop/questionapp/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1183, in main
ToolchainCL()
File "/home/abra/Desktop/questionapp/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 666, in _init_
getattr(self, args.subparser_name.replace('-', '_'))(args)
File "/home/abra/Desktop/questionapp/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 152, in wrapper_func
build_dist_from_args(ctx, dist, args)
File "/home/abra/Desktop/questionapp/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 205, in build_dist_from_args
args, "ignore_setup_py", False
File "pythonforandroid/build.py", line 557, in build_recipes
File "/home/abra/Desktop/questionapp/.buildozer/android/platform/python-for-android/pythonforandroid/recipes/libffi/_init_.py", line 33, in build_arch
shprint(sh.Command('./autogen.sh'), _env=env)
File "pythonforandroid/logger.py", line 178, in shprint
File "/home/abra/.local/lib/python2.7/site-packages/sh.py", line 863, in next
self.wait()
File "/home/abra/.local/lib/python2.7/site-packages/sh.py", line 792, in wait
self.handle_command_exit_code(exit_code)
File "/home/abra/.local/lib/python2.7/site-packages/sh.py", line 815, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_127:
RAN: /home/abra/Desktop/questionapp/.buildozer/android/platform/build/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/autogen.sh
STDOUT:
/home/abra/Desktop/questionapp/.buildozer/android/platform/build/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/autogen.sh: 2: exec: autoreconf: not found
STDERR:
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/abra/Desktop/questionapp/.buildozer/android/platform/build" --ndk-api=21
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
I solved this problem.If someone encounters this error I solved by following these steps
sudo apt update
sudo apt-get install autoconf
pip install --upgrade buildozer
sudo apt install -y git zip unzip openjdk-8-jdk python3-pip autoconf libtool pkg-config zlib1g-dev libncurses5-dev libncursesw5-dev libtinfo5
pip3 install --user --upgrade cython virtualenv

dpkg-buildpackage build is failing to find pip dependencies

I've got a build that's failing, and I've spent the better part of two days tracking down and fixing multiple problems with the build machine. Now it's getting stuck on a part that makes no sense, because what it's doing doesn't seem to follow from the input.
It's running dpkg-buildpackage, and erroring out on the fakeroot debian/build binary step. Here's the part of the build log where it fails:
Collecting lazy-object-proxy (from astroid==1.5.2->-r ./requirements.txt (line 2))
0 location(s) to search for versions of lazy-object-proxy:
Could not find a version that satisfies the requirement lazy-object-proxy (from astroid==1.5.2->-r ./requirements.txt (line 2)) (from versions: )
Cleaning up...
Removing source in /tmp/user/1000/pip-build-5s7d8it1/gevent
Removing source in /tmp/user/1000/pip-build-5s7d8it1/greenlet
Removing source in /tmp/user/1000/pip-build-5s7d8it1/Pillow
Removing source in /tmp/user/1000/pip-build-5s7d8it1/PyYAML
Removing source in /tmp/user/1000/pip-build-5s7d8it1/wrapt
No matching distribution found for lazy-object-proxy (from astroid==1.5.2->-r ./requirements.txt (line 2))
Exception information:
Traceback (most recent call last):
File "/home/username/project-a/debian/project-name/opt/company-name/project-name/lib/python3.5/site-packages/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/home/username/project-name/debian/project-name/opt/company-name/project-name/lib/python3.5/site-packages/pip/commands/install.py", line 291, in run
wb.build(autobuilding=True)
File "/home/username/project-name/debian/project-name/opt/company-name/project-name/lib/python3.5/site-packages/pip/wheel.py", line 704, in build
self.requirement_set.prepare_files(self.finder)
File "/home/username/project-name/debian/project-name/opt/company-name/project-name/lib/python3.5/site-packages/pip/req/req_set.py", line 317, in prepare_files
functools.partial(self._prepare_file, finder))
File "/home/username/project-name/debian/project-name/opt/company-name/project-name/lib/python3.5/site-packages/pip/req/req_set.py", line 304, in _walk_req_to_install
more_reqs = handler(req_to_install)
File "/home/username/project-name/debian/project-name/opt/company-name/project-name/lib/python3.5/site-packages/pip/req/req_set.py", line 439, in _prepare_file
req_to_install.populate_link(finder, self.upgrade)
File "/home/username/project-name/debian/project-name/opt/company-name/project-name/lib/python3.5/site-packages/pip/req/req_install.py", line 244, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/home/username/project-name/debian/project-name/opt/company-name/project-name/lib/python3.5/site-packages/pip/index.py", line 563, in find_requirement
'No matching distribution found for %s' % req
pip.exceptions.DistributionNotFound: No matching distribution found for lazy-object-proxy (from astroid==1.5.2->-r ./requirements.txt (line 2))
Traceback (most recent call last):
File "/usr/bin/dh_virtualenv", line 106, in <module>
sys.exit(main() or 0)
File "/usr/bin/dh_virtualenv", line 86, in main
deploy.install_dependencies()
File "/usr/lib/python2.7/dist-packages/dh_virtualenv/deployment.py", line 165, in install_dependencies
subprocess.check_call(self.pip('-r', requirements_path))
File "/usr/lib/python2.7/subprocess.py", line 511, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/username/project-name/debian/project-name/opt/company-name/project-name/bin/python', '/home/username/project-name/debian/project-name/opt/company-name/project-name/bin/pip', '-v', 'install', '--log=/tmp/user/1000/tmpYI75My', '--no-index', '--find-links=pypi', '-r', './requirements.txt']' returned non-zero exit status 1
make[1]: *** [override_dh_virtualenv] Error 1
make[1]: Leaving directory `/home/username/project-name'
make: *** [binary] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2
Traceback (most recent call last):
File "./build-dpkg", line 116, in <module>
sys.exit(main(args=sys.argv[1:]))
File "./build-dpkg", line 34, in main
build_package()
File "./build-dpkg", line 104, in build_package
check_call('dpkg-buildpackage -us -uc'.split())
File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['dpkg-buildpackage', '-us', '-uc']' returned non-zero exit status 2
Here's the rules file it's trying to execute:
#!/usr/bin/make -f
%:
dh $# --with python-virtualenv
override_dh_virtualenv:
DH_VIRTUALENV_INSTALL_ROOT=/opt/company-name dh_virtualenv --python=/usr/bin/python3.5 --extra-pip-arg --no-index \
--extra-pip-arg --find-links=pypi -v --no-test
We have a pypi folder that houses local copies of dependencies. Both astroid and lazy-object-proxy are present in this folder.
Looking at the output, it appears that the command it's trying to run that's failing is:
/home/username/project-name/debian/project-name/opt/company-name/project-name/bin/python /home/username/project-name/debian/project-name/opt/company-name/project-name/bin/pip -v install --no-index --find-links=pypi -r ./requirements.txt
If I run that same command on the command line, I can reproduce the failure. But if I change the first part (the executable name with the long path) to simply "python", everything runs as expected. But I can't see why it's using that long path in the first place, when the environment specifies --python=/usr/bin/python3.5!
Does anyone have any idea where this rogue Python invocation is coming from, and how I can fix it?

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

Error while running requirement.txt

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

Categories

Resources