I want put my working app on Heroku. The application using Django and chat based on Twisted websockets. I don't know it's good approach but I installed twisted via heroku bash, but when i want to run my chatserver.py I have an exception because some Twisted module requires OpenSSL which is not installed on my env.
So simply question, how to install Twisted to work with websocket on Heroku?
Update
when I run twistd -n -y chatserver.py:
Unhandled Error
Traceback (most recent call last):
File "/app/.heroku/python/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/application/app.py", line 652, in run
runApp(config)
File "/app/.heroku/python/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/scripts/twistd.py", line 23, in runApp
_SomeApplicationRunner(config).run()
File "/app/.heroku/python/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/application/app.py", line 386, in run
self.application = self.createOrGetApplication()
File "/app/.heroku/python/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/application/app.py", line 451, in createOrGetApplication
application = getApplication(self.config, passphrase)
--- <exception caught here> ---
File "/app/.heroku/python/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/application/app.py", line 462, in getApplication
application = service.loadApplication(filename, style, passphrase)
File "/app/.heroku/python/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/application/service.py", line 405, in loadApplication
application = sob.loadValueFromFile(filename, 'application', passphrase)
File "/app/.heroku/python/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/persisted/sob.py", line 210, in loadValueFromFile
exec fileObj in d, d
File "chatserver.py", line 37, in <module>
from twisted.web.websockets import WebSocketsResource, lookupProtocolForFactory
File "/app/.heroku/python/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/web/websockets.py", line 28, in <module>
from twisted.protocols.tls import TLSMemoryBIOProtocol
File "/app/.heroku/python/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/protocols/tls.py", line 40, in <module>
from OpenSSL.SSL import Error, ZeroReturnError, WantReadError
exceptions.ImportError: No module named OpenSSL.SSL
Failed to load application: No module named OpenSSL.SSL
So when I try to install openssl with command: pip install pyopenssl
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_u12732/cryptography/setup.py", line 174, in <module>
"test": PyTest,
File "/app/.heroku/python/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 260, in __init__
File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 285, in fetch_build_eggs
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 631, in resolve
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 871, in best_match
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 883, in obtain
File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 335, in fetch_build_egg
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 595, in easy_install
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 625, in install_item
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 822, in install_eggs
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1028, in build_and_install
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1016, in run_setup
distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_u12732/cryptography
Traceback (most recent call last):
File "/app/.heroku/python/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/__init__.py", line 185, in main
return command.main(cmd_args)
File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 75: ordinal not in range(128)
Related
When I run django server, It says "ModuleNotFoundError: No module named 'ws4redis'".
When I try to install ws4redis using the PIP command, I says syntax error.
pip install django-websocket-redis
Here is the tracebacks of the errors:
Collecting django-websocket-redis
Using cached django-websocket-redis-0.5.1.tar.gz
Exception:
Traceback (most recent call last):
File "/anaconda3/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/anaconda3/lib/python3.6/site-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/anaconda3/lib/python3.6/site-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/anaconda3/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/anaconda3/lib/python3.6/site-packages/pip/req/req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "/anaconda3/lib/python3.6/site-packages/pip/req/req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "/anaconda3/lib/python3.6/site-packages/pip/req/req_install.py", line 412, in run_egg_info
self.setup_py, self.name,
File "/anaconda3/lib/python3.6/site-packages/pip/req/req_install.py", line 387, in setup_py
import setuptools # noqa
File "/Users/ranjan/.local/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg/setuptools/__init__.py", line 2, in <module>
from setuptools.extension import Extension, Library
File "/Users/ranjan/.local/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg/setuptools/extension.py", line 5, in <module>
from setuptools.dist import _get_unpatched
File "/Users/ranjan/.local/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 103
except ValueError, e:
^
SyntaxError: invalid syntax
Under Ubuntu 16.04 and Python 2.7.12 sudo -H pip install pyublas fails with the following stacktrace:
Collecting pyublas
Using cached PyUblas-2013.1.tar.gz
Complete output from command python setup.py egg_info:
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.35.tar.gz
Extracting in /tmp/tmpnYhYMx
Now working in /tmp/tmpnYhYMx/distribute-0.6.35
Building a Distribute egg in /tmp/pip-build-vvsChR/pyublas
Traceback (most recent call last):
File "setup.py", line 248, in <module>
scripts = scripts,
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/tmp/tmpnYhYMx/distribute-0.6.35/setuptools/dist.py", line 225, in __init__
_Distribution.__init__(self,attrs)
File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/tmp/tmpnYhYMx/distribute-0.6.35/setuptools/dist.py", line 257, in finalize_options
ep.require(installer=self.fetch_build_egg)
File "/tmp/tmpnYhYMx/distribute-0.6.35/pkg_resources.py", line 2027, in require
working_set.resolve(self.dist.requires(self.extras),env,installer))
File "/tmp/tmpnYhYMx/distribute-0.6.35/pkg_resources.py", line 2237, in requires
dm = self._dep_map
File "/tmp/tmpnYhYMx/distribute-0.6.35/pkg_resources.py", line 2466, in _dep_map
self.__dep_map = self._compute_dependencies()
File "/tmp/tmpnYhYMx/distribute-0.6.35/pkg_resources.py", line 2499, in _compute_dependencies
common = frozenset(reqs_for_extra(None))
File "/tmp/tmpnYhYMx/distribute-0.6.35/pkg_resources.py", line 2496, in reqs_for_extra
if req.marker_fn(override={'extra':extra}):
File "/tmp/tmpnYhYMx/distribute-0.6.35/_markerlib/markers.py", line 109, in marker_fn
return eval(compiled_marker, environment)
File "<environment marker>", line 1, in <module>
NameError: name 'sys_platform' is not defined
/tmp/pip-build-vvsChR/pyublas/distribute-0.6.35-py2.7.egg
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-vvsChR/pyublas/setup.py", line 143, in <module>
main()
File "/tmp/pip-build-vvsChR/pyublas/setup.py", line 29, in main
from aksetup_helper import hack_distutils, get_config, setup, \
File "aksetup_helper.py", line 3, in <module>
distribute_setup.use_setuptools()
File "distribute_setup.py", line 152, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "distribute_setup.py", line 132, in _do_download
_build_egg(egg, tarball, to_dir)
File "distribute_setup.py", line 123, in _build_egg
raise IOError('Could not build the egg.')
IOError: Could not build the egg.
Following various related SO answers, I have confirmed that distribute is not installed, setuptools is up to date (setuptools (36.0.1)).
I have also tried manually running setup per this answer to no avail.
I am new to python, and after reading the running some examples, I wanted to try statsmodels.
I copied the following example from statsmodels website,
#!/usr/bin/env python3
import numpy as np
import statsmodels.api as sm
spector_data = sm.datasets.spector.load()
spector_data.exog = sm.add_constant(spector_data.exog, prepend=False)
#Fit and summarize OLS model
mod = sm.OLS(spector_data.endog, spector_data.exog)
res = mod.fit()
print (res.summary())
and I get the following error:
Running unit tests for scipy
Traceback (most recent call last):
File "./statsmodels.py", line 3, in <module>
import statsmodels.api as sm
File "/home/ra/python/statsmodels.py", line 3, in <module>
scipy.test()
File "/usr/lib/python3/dist-packages/numpy/testing/nosetester.py", line 318, in test
self._show_system_info()
File "/usr/lib/python3/dist-packages/numpy/testing/nosetester.py", line 187, in _show_system_info
nose = import_nose()
File "/usr/lib/python3/dist-packages/numpy/testing/nosetester.py", line 69, in import_nose
raise ImportError(msg)
ImportError: Need nose >= 0.10.0 for tests - see http://somethingaboutorange.com/mrl/projects/nose
so, I ran the below command for statsmodels, and it gave me the following message upon running the install:
sudo easy_install3 -U statsmodels
Searching for statsmodels
Reading http://pypi.python.org/simple/statsmodels/
Reading http://statsmodels.sourceforge.net/
Reading https://github.com/statsmodels/statsmodels/downloads
Best match: statsmodels 0.5.0
Downloading https://pypi.python.org/packages/source/s/statsmodels/statsmodels-0.5.0.zip#md5=4ed78e8c6ababdcae0400fc0fe6f31a7
Processing statsmodels-0.5.0.zip
Running statsmodels-0.5.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-hnrc4z/statsmodels-0.5.0/egg-dist-tmp-2_kign
Traceback (most recent call last):
File "setup.py", line 116, in check_dependency_versions
ImportError: No module named pandas.version
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/easy_install3", line 9, in <module>
load_entry_point('distribute==0.6.24dev-r0', 'console_scripts', 'easy_install')()
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1931, in main
with_ei_usage(lambda:
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1912, in with_ei_usage
return f()
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1935, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "/usr/lib/python3.2/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.2/distutils/dist.py", line 917, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.2/distutils/dist.py", line 936, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 368, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 608, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 638, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 828, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1105, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1094, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 31, in run_setup
lambda: exec(compile(open(
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 73, in run
return func()
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 34, in <lambda>
{'__file__':setup_script, '__name__':'__main__'})
File "setup.py", line 463, in <module>
File "setup.py", line 118, in check_dependency_versions
ImportError: statsmodels requires pandas
So, I ran the below to make sure I had the latest pandas (I had run the sudo apt-get install python-pandas before, but since statsmodels did not find that, I did the below:
sudo easy_install3 -U pandas
Searching for pandas
Reading http://pypi.python.org/simple/pandas/
Best match: pandas 0.14.0
Downloading https://pypi.python.org/packages/source/p/pandas/pandas-0.14.0.zip#md5=9afe57bd470a2ddaf67bdfb5fc9c0eee
Processing pandas-0.14.0.zip
Running pandas-0.14.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-deg0nw/pandas-0.14.0/egg-dist-tmp-19hrp_
warning: no files found matching 'README.rst'
no previously-included directories found matching 'doc/build'
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.pyd' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.git*' found anywhere in distribution
warning: no previously-included files matching '.DS_Store' found anywhere in distribution
warning: no previously-included files matching '*.png' found anywhere in distribution
pandas/index.c:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
Where's my error this time.
btw, this is the version of pandas I see from my python prompt:
>>> import pandas
/usr/local/lib/python2.7/dist-packages/pandas/io/excel.py:626: UserWarning: Installed openpyxl is not supported at this time. Use >=1.6.1 and <2.0.0.
.format(openpyxl_compat.start_ver, openpyxl_compat.stop_ver))
>>> pandas.__version__
'0.14.0'
I don't understand why I get that message when I import.
Also, I wanted to post the results of which, in case that might be of any use:
ra#ra-VGN-FZ:~$ which python
/usr/bin/python
ra#ra-VGN-FZ:~$ which easy_install
/usr/bin/easy_install
ra#ra-VGN-FZ:~$ which pip3
/usr/local/bin/pip3
To solve openpyxl problem, I did the following:
pip uninstall openpyxl
Cannot uninstall requirement openpyxl, not installed
Storing debug log for failure in /tmp/tmpci3yro
ra#ra-VGN-FZ19:~$ pip install openpyxl==1.8.6
Downloading/unpacking openpyxl==1.8.6
Downloading openpyxl-1.8.6-py2.py3-none-any.whl (190kB): 190kB downloaded
Installing collected packages: openpyxl
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/pip-1.5.6-py3.2.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/local/lib/python3.2/dist-packages/pip-1.5.6-py3.2.egg/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/local/lib/python3.2/dist-packages/pip-1.5.6-py3.2.egg/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/local/lib/python3.2/dist-packages/pip-1.5.6-py3.2.egg/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/usr/local/lib/python3.2/dist-packages/pip-1.5.6-py3.2.egg/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/usr/local/lib/python3.2/dist-packages/pip-1.5.6-py3.2.egg/pip/wheel.py", line 215, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/local/lib/python3.2/dist-packages/pip-1.5.6-py3.2.egg/pip/wheel.py", line 205, in clobber
os.makedirs(destdir)
File "/usr/lib/python3.2/os.py", line 152, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python3.2/dist-packages/openpyxl-1.8.6.dist-info'
Storing debug log for failure in /tmp/tmp15h3o4
This is the error with python3:
sudo easy_install3 -U statsmodels
Searching for statsmodels
Reading http://pypi.python.org/simple/statsmodels/
Reading http://statsmodels.sourceforge.net/
Reading https://github.com/statsmodels/statsmodels/downloads
Best match: statsmodels 0.5.0
Downloading https://pypi.python.org/packages/source/s/statsmodels/statsmodels-0.5.0.zip#md5=4ed78e8c6ababdcae0400fc0fe6f31a7
Processing statsmodels-0.5.0.zip
Running statsmodels-0.5.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-oudla7/statsmodels-0.5.0/egg-dist-tmp-o6dh5a
Traceback (most recent call last):
File "setup.py", line 120, in check_dependency_versions
ImportError: No module named patsy
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/easy_install3", line 9, in <module>
load_entry_point('distribute==0.6.24dev-r0', 'console_scripts', 'easy_install')()
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1931, in main
with_ei_usage(lambda:
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1912, in with_ei_usage
return f()
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1935, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "/usr/lib/python3.2/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.2/distutils/dist.py", line 917, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.2/distutils/dist.py", line 936, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 368, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 608, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 638, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 828, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1105, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1094, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 31, in run_setup
lambda: exec(compile(open(
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 73, in run
return func()
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 34, in <lambda>
{'__file__':setup_script, '__name__':'__main__'})
File "setup.py", line 463, in <module>
File "setup.py", line 122, in check_dependency_versions
ImportError: statsmodels requires patsy. http://patsy.readthedocs.org
ra#ra-VGN-FZ19:~$ sudo easy_install3 -U patsy
Searching for patsy
Reading http://pypi.python.org/simple/patsy/
Best match: patsy 0.2.1
Downloading https://pypi.python.org/packages/source/p/patsy/patsy-0.2.1.zip#md5=d51fa2fcb60018d75073f375c87ddccf
Processing patsy-0.2.1.zip
Running patsy-0.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-l1wpxc/patsy-0.2.1/egg-dist-tmp-2qgd7e
no previously-included directories found matching 'doc/_build'
zip_safe flag not set; analyzing archive contents...
Adding patsy 0.2.1 to easy-install.pth file
Installed /usr/local/lib/python3.2/dist-packages/patsy-0.2.1-py3.2.egg
Processing dependencies for patsy
Finished processing dependencies for patsy
Thanks to Jonathan Villemaire-Krajden who misled me while i was seeking a solution to show() in matplotlib, my statsmodels has broken.
I tried to reinstall statsmodels and now I get the following error:
easy_install3 -U statsmodels
Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 449, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 742, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 643, in resolve
raise VersionConflict(dist, req) # XXX put more info here
pkg_resources.VersionConflict: (distribute 0.7.3 (/usr/local/lib/python3.2/dist-packages/distribute-0.7.3-py3.2.egg), Requirement.parse('distribute==0.6.24dev-r0'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/easy_install3", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 2837, in <module>
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 451, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 464, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 799, in __init__
self.scan(search_path)
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 829, in scan
self.add(dist)
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 849, in add
dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
TypeError: unorderable types: NoneType() < str()
ra#ra-VGN-FZ19:~$ sudo easy_install3 -U statsmodels
Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 449, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 742, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 643, in resolve
raise VersionConflict(dist, req) # XXX put more info here
pkg_resources.VersionConflict: (distribute 0.7.3 (/usr/local/lib/python3.2/dist-packages/distribute-0.7.3-py3.2.egg), Requirement.parse('distribute==0.6.24dev-r0'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/easy_install3", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 2837, in <module>
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 451, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 464, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 799, in __init__
self.scan(search_path)
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 829, in scan
self.add(dist)
File "/usr/local/lib/python3.2/dist-packages/setuptools-5.1-py3.2.egg/pkg_resources.py", line 849, in add
dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
TypeError: unorderable types: NoneType() < str()
sudo pip3 install statsmodels
Downloading/unpacking statsmodels
Downloading statsmodels-0.5.0.tar.gz (5.5MB): 5.5MB downloaded
Running setup.py (path:/tmp/pip_build_root/statsmodels/setup.py) egg_info for package statsmodels
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/statsmodels/setup.py", line 463, in <module>
check_dependency_versions(min_versions)
File "/tmp/pip_build_root/statsmodels/setup.py", line 109, in check_dependency_versions
from scipy.version import short_version as spversion
File "/usr/lib/python3/dist-packages/scipy/__init__.py", line 124, in <module>
pkgload(verbose=SCIPY_IMPORT_VERBOSE,postpone=True)
File "/usr/local/lib/python3.2/dist-packages/numpy/_import_tools.py", line 177, in __call__
for package_name in self._get_sorted_names():
File "/usr/local/lib/python3.2/dist-packages/numpy/_import_tools.py", line 114, in _get_sorted_names
for name in depend_dict.keys():
RuntimeError: dictionary changed size during iteration
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/statsmodels/setup.py", line 463, in <module>
check_dependency_versions(min_versions)
File "/tmp/pip_build_root/statsmodels/setup.py", line 109, in check_dependency_versions
from scipy.version import short_version as spversion
File "/usr/lib/python3/dist-packages/scipy/__init__.py", line 124, in <module>
pkgload(verbose=SCIPY_IMPORT_VERBOSE,postpone=True)
File "/usr/local/lib/python3.2/dist-packages/numpy/_import_tools.py", line 177, in __call__
for package_name in self._get_sorted_names():
File "/usr/local/lib/python3.2/dist-packages/numpy/_import_tools.py", line 114, in _get_sorted_names
for name in depend_dict.keys():
RuntimeError: dictionary changed size during iteration
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/statsmodels
Storing debug log for failure in /home/ra/.pip/pip.log
You are running statsmodels.py with Python 3, and almost certainly running ipython with Python 2.
When you install with pip it usesPython 2, and installs the packages in a different location than where Python 3 looks.
Either install nose using pip3 (if you have it installed - read here if not)
sudo pip3 install nose
or run your statsmodels.py with Python 2 (replace python3 with python on your first line):
#!/usr/bin/env python
I am trying to install GDAL in virtual environment based on the various solutions out there.
However the download itself already fails:
$ pip install --no-install GDAL
Here is the pip.log
------------------------------------------------------------
/Users/test/venv/bin/pip run on Sun Jun 2 15:35:15 2013
Downloading/unpacking GDAL
Running setup.py egg_info for package GDAL
running egg_info
writing pip-egg-info/GDAL.egg-info/PKG-INFO
writing top-level names to pip-egg-info/GDAL.egg-info/top_level.txt
writing dependency_links to pip-egg-info/GDAL.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/Users/test/venv/build/GDAL/setup.py", line 267, in <module>
ext_modules = ext_modules )
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "<string>", line 14, in replacement_run
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/egg_info.py", line 259, in find_sources
mm.run()
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/egg_info.py", line 325, in run
self.add_defaults()
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/egg_info.py", line 361, in add_defaults
sdist.add_defaults(self)
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/sdist.py", line 211, in add_defaults
build_ext = self.get_finalized_command('build_ext')
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
cmd_obj.ensure_finalized()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/Users/test/venv/build/GDAL/setup.py", line 164, in finalize_options
self.gdaldir = self.get_gdal_config('prefix')
File "/Users/test/venv/build/GDAL/setup.py", line 144, in get_gdal_config
return fetch_config(option)
File "/Users/test/venv/build/GDAL/setup.py", line 97, in fetch_config
raise gdal_config_error, e""")
File "<string>", line 4, in <module>
__main__.gdal_config_error: [Errno 2] No such file or directory
Complete output from command python setup.py egg_info:
running egg_info
writing pip-egg-info/GDAL.egg-info/PKG-INFO
writing top-level names to pip-egg-info/GDAL.egg-info/top_level.txt
writing dependency_links to pip-egg-info/GDAL.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/Users/test/venv/build/GDAL/setup.py", line 267, in <module>
ext_modules = ext_modules )
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "<string>", line 14, in replacement_run
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/egg_info.py", line 259, in find_sources
mm.run()
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/egg_info.py", line 325, in run
self.add_defaults()
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/egg_info.py", line 361, in add_defaults
sdist.add_defaults(self)
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/sdist.py", line 211, in add_defaults
build_ext = self.get_finalized_command('build_ext')
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
cmd_obj.ensure_finalized()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/Users/test/venv/build/GDAL/setup.py", line 164, in finalize_options
self.gdaldir = self.get_gdal_config('prefix')
File "/Users/test/venv/build/GDAL/setup.py", line 144, in get_gdal_config
return fetch_config(option)
File "/Users/test/venv/build/GDAL/setup.py", line 97, in fetch_config
raise gdal_config_error, e""")
File "<string>", line 4, in <module>
__main__.gdal_config_error: [Errno 2] No such file or directory
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /Users/test/venv/build/GDAL
Exception information:
Traceback (most recent call last):
File "/Users/test/venv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/basecommand.py", line 139, in main
status = self.run(options, args)
File "/Users/test/venv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/commands/install.py", line 266, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/Users/test/venv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 1057, in prepare_files
req_to_install.run_egg_info()
File "/Users/test/venv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 236, in run_egg_info
command_desc='python setup.py egg_info')
File "/Users/test/venv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/util.py", line 662, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /Users/test/venv/build/GDAL
What am I missing?
The workaround given by #user1738154 didn't work as expected for me so went ahead and installed GDAL using HomeBrew then using pip into my Virtual environment.
$ brew install gdal
(venv)$ pip install GDAL
Everything compiled and ran like a charm.
A workaround to that problem is to
Download GDAL Complete from this site
Install GDAL Complete.pkg
Go to /Library/Frameworks/GDAL.framework/Versions/1.10/ and copy all files in there
Go to your virtual environment's sites-packages /venv/lib/python2.7/site-packages and paste the copied files in there
after install gdal using these steps on host:
sudo apt-get install gdal-bin
sudo apt-get install libgdal-dev
After that use
pip install GDAL==$(gdal-config --version) --global-option=build_ext --global-option="-I/usr/include/gdal"
This should work like charm
I am facing an issue while trying to install the requirements for my django project.
I am unable to figure out why I'm getting this error.
Can someone lead me in the right direction?
>Running setup.py egg_info for package django-staticfiles
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/Users/glosseyvilly/Desktop/Workspace/chris_dev/mysite-env/build/django-staticfiles/setup.py", line 128, in <module>
'versiontools >= 1.6',
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py", line 113, in setup
_setup_distribution = dist = klass(attrs)
File "build/bdist.linux-i686/egg/setuptools/dist.py", line 260, in __init__
File "build/bdist.linux-i686/egg/setuptools/dist.py", line 284, in fetch_build_eggs
File "build/bdist.linux-i686/egg/pkg_resources.py", line 563, in resolve
plugin_projects = list(plugin_env)
File "build/bdist.linux-i686/egg/pkg_resources.py", line 799, in best_match
File "build/bdist.linux-i686/egg/pkg_resources.py", line 811, in obtain
File "build/bdist.linux-i686/egg/setuptools/dist.py", line 327, in fetch_build_egg
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 446, in easy_install
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 476, in install_item
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 655, in install_eggs
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 930, in build_and_install
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 919, in run_setup
File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 62, in run_setup
File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 105, in run
File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 64, in <lambda>
File "setup.py", line 29, in <module>
in a distutils ``setup.py`` file.
File "/var/folders/zm/zmC41KkWH5ObUL0cyVjWL++++TI/-Tmp-/easy_install-wsSHXC/versiontools-1.8.1/versiontools/__init__.py", line 354, in format_version
File "/var/folders/zm/zmC41KkWH5ObUL0cyVjWL++++TI/-Tmp-/easy_install-wsSHXC/versiontools-1.8.1/versiontools/__init__.py", line 183, in from_tuple
File "/var/folders/zm/zmC41KkWH5ObUL0cyVjWL++++TI/-Tmp-/easy_install-wsSHXC/versiontools-1.8.1/versiontools/__init__.py", line 126, in __new__
File "/var/folders/zm/zmC41KkWH5ObUL0cyVjWL++++TI/-Tmp-/easy_install-wsSHXC/versiontools-1.8.1/versiontools/__init__.py", line 279, in _find_source_tree
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 936, in getouterframes
framelist.append((frame,) + getframeinfo(frame, context))
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 911, in getframeinfo
lines, lnum = findsource(frame)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 573, in findsource
if pat.match(lines[lnum]): break
IndexError: list index out of range
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/Users/glosseyvilly/Desktop/Workspace/chris_dev/mysite-env/build/django-staticfiles/setup.py", line 128, in <module>
'versiontools >= 1.6',
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py", line 113, in setup
_setup_distribution = dist = klass(attrs)
File "build/bdist.linux-i686/egg/setuptools/dist.py", line 260, in __init__
File "build/bdist.linux-i686/egg/setuptools/dist.py", line 284, in fetch_build_eggs
File "build/bdist.linux-i686/egg/pkg_resources.py", line 563, in resolve
plugin_projects = list(plugin_env)
File "build/bdist.linux-i686/egg/pkg_resources.py", line 799, in best_match
File "build/bdist.linux-i686/egg/pkg_resources.py", line 811, in obtain
File "build/bdist.linux-i686/egg/setuptools/dist.py", line 327, in fetch_build_egg
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 446, in easy_install
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 476, in install_item
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 655, in install_eggs
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 930, in build_and_install
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 919, in run_setup
File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 62, in run_setup
File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 105, in run
File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 64, in <lambda>
File "setup.py", line 29, in <module>
in a distutils ``setup.py`` file.
File "/var/folders/zm/zmC41KkWH5ObUL0cyVjWL++++TI/-Tmp-/easy_install-wsSHXC/versiontools-1.8.1/versiontools/__init__.py", line 354, in format_version
File "/var/folders/zm/zmC41KkWH5ObUL0cyVjWL++++TI/-Tmp-/easy_install-wsSHXC/versiontools-1.8.1/versiontools/__init__.py", line 183, in from_tuple
File "/var/folders/zm/zmC41KkWH5ObUL0cyVjWL++++TI/-Tmp-/easy_install-wsSHXC/versiontools-1.8.1/versiontools/__init__.py", line 126, in __new__
File "/var/folders/zm/zmC41KkWH5ObUL0cyVjWL++++TI/-Tmp-/easy_install-wsSHXC/versiontools-1.8.1/versiontools/__init__.py", line 279, in _find_source_tree
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 936, in getouterframes
framelist.append((frame,) + getframeinfo(frame, context))
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 911, in getframeinfo
lines, lnum = findsource(frame)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 573, in findsource
if pat.match(lines[lnum]): break
IndexError: list index out of range
----------------------------------------
Command python setup.py egg_info failed with error code 1
Exception information:
Traceback (most recent call last):
File "/Library/Python/2.6/site-packages/pip-1.0.2-py2.6.egg/pip/basecommand.py", line 126, in main
self.run(options, args)
File "/Library/Python/2.6/site-packages/pip-1.0.2-py2.6.egg/pip/commands/install.py", line 223, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/Library/Python/2.6/site-packages/pip-1.0.2-py2.6.egg/pip/req.py", line 986, in prepare_files
req_to_install.run_egg_info()
File "/Library/Python/2.6/site-packages/pip-1.0.2-py2.6.egg/pip/req.py", line 222, in run_egg_info
command_desc='python setup.py egg_info')
File "/Library/Python/2.6/site-packages/pip-1.0.2-py2.6.egg/pip/__init__.py", line 255, in call_subprocess
% (command_desc, proc.returncode))
InstallationError: Command python setup.py egg_info failed with error code 1
I ran into this same error while using the native Python 2.6.1 on Mac OS X 10.6 to install django-imagekit. Some googling revealed this:
https://github.com/jezdez/django_compressor/issues/181
which suggested this:
pip install versiontools
and then I was able to install django-imagekit.
Same issue when I try to install MySQL-python
apt-get install libmysqlclient-dev python-dev
solved my problem.
I think you need to install the python-dev version. Hope that helps
From this error
framelist.append((frame,) + getframeinfo(frame, context))
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 911, in getframeinfo
lines, lnum = findsource(frame)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 573, in findsource
if pat.match(lines[lnum]): break
IndexError: list index out of range
it appears that findsource(frame) is unable to find a legal lnum for frame. Are you sure that all the programs are aligned to known compatible versions (python, django, pip, etc)?
Before risking to pollute your system installation of python, I suggest that you use virtualenv to isolate the python environment from the one shipped with the OS.