compiling statsmodels example in ubuntu 12.04 - python

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

Related

Pip3: Cython error while installing spicy

This is my requirements.txt file below:
emoji==1.2.0
langdetect==1.0.8
Pillow==9.0.0
PyMySQL==0.10.1
pyOpenSSL==19.1.0
pytz==2020.1
redis==3.5.3
regex==2021.8.3
requests==2.24.0
selenium==3.141.0
nltk==3.6.6
cython==0.29.26
numpy==1.21.1
setuptools==59.6.0
scipy==1.5.4
geograpy3==0.2.2
geotext~=0.4.0
DateTime~=4.3
uuid~=1.30
Jinja2~=2.11.2
boto3==1.17.3
Traceback
Collecting selenium==3.141.0 (from -r requirements.txt (line 10))
Using cached https://files.pythonhosted.org/packages/80/d6/4294f0b4bce4de0abf13e17190289f9d0613b0a44e5dd6a7f5ca98459853/selenium-3.141.0-py2.py3-none-any.whl
Collecting nltk==3.6.6 (from -r requirements.txt (line 11))
Using cached https://files.pythonhosted.org/packages/90/35/8848a41a983a923aa2496fbe4ee4df796c6b32b2a59f04c2b2047aafd3c3/nltk-3.6.6-py3-none-any.whl
Collecting cython==0.29.26 (from -r requirements.txt (line 12))
Using cached https://files.pythonhosted.org/packages/15/29/2abb8975ded365d55b9e14129cabdfb977255911c80d8709028eca5829cd/Cython-0.29.26-py2.py3-none-any.whl
Collecting numpy==1.21.1 (from -r requirements.txt (line 13))
Using cached https://files.pythonhosted.org/packages/0b/a7/e724c8df240687b5fd62d8c71f1a6709d455c4c09432c7412e3e64f4cbe5/numpy-1.21.1.zip
Collecting setuptools==59.6.0 (from -r requirements.txt (line 14))
Using cached https://files.pythonhosted.org/packages/b0/3a/88b210db68e56854d0bcf4b38e165e03be377e13907746f825790f3df5bf/setuptools-59.6.0-py3-none-any.whl
Collecting scipy==1.5.4 (from -r requirements.txt (line 15))
Using cached https://files.pythonhosted.org/packages/aa/d5/dd06fe0e274e579e1dff21aa021219c039df40e39709fabe559faed072a5/scipy-1.5.4.tar.gz
Complete output from command python setup.py egg_info:
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_philox.pyx
Traceback (most recent call last):
File "/tmp/easy_install-5cn5y70d/numpy-1.22.3/tools/cythonize.py", line 53, in process_pyx
import Cython
ModuleNotFoundError: No module named 'Cython'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/tmp/easy_install-5cn5y70d/numpy-1.22.3/tools/cythonize.py", line 234, in <module>
main()
File "/tmp/easy_install-5cn5y70d/numpy-1.22.3/tools/cythonize.py", line 230, in main
find_process_files(root_dir)
File "/tmp/easy_install-5cn5y70d/numpy-1.22.3/tools/cythonize.py", line 221, in find_process_files
process(root_dir, fromfile, tofile, function, hash_db)
File "/tmp/easy_install-5cn5y70d/numpy-1.22.3/tools/cythonize.py", line 187, in process
processor_function(fromfile, tofile)
File "/tmp/easy_install-5cn5y70d/numpy-1.22.3/tools/cythonize.py", line 60, in process_pyx
raise OSError(msg) from e
OSError: Cython needs to be installed in Python as a module
Running from numpy source directory.
Traceback (most recent call last):
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-5cn5y70d/numpy-1.22.3/setup.py", line 461, in <module>
"generating Cython sources and expanding templates".format(
File "/tmp/easy_install-5cn5y70d/numpy-1.22.3/setup.py", line 443, in setup_package
bad_commands[command] = "`setup.py %s` is not supported" % command
File "/tmp/easy_install-5cn5y70d/numpy-1.22.3/setup.py", line 248, in generate_cython
f.write(text)
RuntimeError: Running cythonize failed!
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-tqtljvxv/scipy/setup.py", line 583, in <module>
setup_package()
File "/tmp/pip-build-tqtljvxv/scipy/setup.py", line 579, in setup_package
setup(**metadata)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/__init__.py", line 128, in setup
_install_setup_requires(attrs)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/__init__.py", line 123, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/dist.py", line 510, in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve(
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/pkg_resources/__init__.py", line 772, in resolve
dist = best[req.key] = env.best_match(
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1057, in best_match
return self.obtain(req, installer)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1069, in obtain
return installer(requirement)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/dist.py", line 580, in fetch_build_egg
return cmd.easy_install(req)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 698, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 724, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 909, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 1177, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 1163, in run_setup
run_setup(setup_script, args)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/sandbox.py", line 253, in run_setup
raise
File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/sandbox.py", line 166, in save_modules
saved_exc.resume()
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/sandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/_vendor/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/home/odroid/Documents/data-crawling-env/lib/python3.8/site-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-5cn5y70d/numpy-1.22.3/setup.py", line 461, in <module>
"generating Cython sources and expanding templates".format(
File "/tmp/easy_install-5cn5y70d/numpy-1.22.3/setup.py", line 443, in setup_package
bad_commands[command] = "`setup.py %s` is not supported" % command
File "/tmp/easy_install-5cn5y70d/numpy-1.22.3/setup.py", line 248, in generate_cython
f.write(text)
RuntimeError: Running cythonize failed!
Cythonizing sources
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-tqtljvxv/scipy/
It looks like related to Cython in spicy package? Does anyone got this error.
Thank you guy for helping me.
I fixed this problem.
The reason is my pip3 version was too old (v.9).
So I updated it to the newest version, it work like charm.
sudo python3 -m pip install -U pip

dIjango-websocket-redis Module Error on Installation

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

Error importing termcolor in python 2.5

I'm using python 2.5 on a lenny-5 64 bit version. I have installed termcolor before and have used it too. Suddenly I can't use it now. I got this error for import termcolor:
>>> import termcolor
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "termcolor.py", line 124
print((colored(text, color, on_color, attrs)), **kwargs)
^
SyntaxError: invalid syntax
I don't know if I violated any constraint or dependency by installing some other module. I don't even know what happened to this lib. Any idea?
I tried to re-install this package using pip and I got this:
# pip uninstall termcolor
Cannot uninstall requirement termcolor, not installed
Storing complete log in /root/.pip/pip.log
I tried to install it using pip and I got this:
# pip install termcolor
Downloading/unpacking termcolor
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/basecommand.py", line 139, in main
status = self.run(options, args)
File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/commands/install.py", line 266, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/req.py", line 1026, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/index.py", line 125, in find_requirement
page = self._get_page(main_index_url, req)
File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/index.py", line 353, in _get_page
return HTMLPage.get_page(link, req, cache=self.cache)
File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/index.py", line 471, in get_page
resp = urlopen(url)
File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/download.py", line 143, in __call__
response = self.get_opener(scheme=scheme).open(url)
File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/download.py", line 201, in get_opener
raise NoSSLError()
NoSSLError:
###################################################################
## You don't have an importable ssl module. You are most ##
## likely using Python 2.5, which did not include ssl ##
## support by default. In this state, we can not provide ##
## ssl certified downloads from PyPI. ##
## ##
## You can do one of 2 things: ##
## 1) Install this: https://pypi.python.org/pypi/ssl/ ##
## (It provides ssl support for older Pythons ) ##
## 2) Use the --insecure option to allow this insecurity ##
## ##
## For more details, go to the "SSL Certificate Verification" ##
## section located here: ##
## http://www.pip-installer.org/en/latest/logic.html ##
## ##
###################################################################
Storing complete log in /root/.pip/pip.log
I tried easy_install to install it again; this is the output:
# easy_install termcolor
Searching for termcolor
Reading http://pypi.python.org/simple/termcolor/
Best match: termcolor 1.1.0
Downloading https://pypi.python.org/packages/source/t/termcolor/termcolor-1.1.0.tar.gz#md5=043e89644f8909d462fbbfa511c768df
Processing termcolor-1.1.0.tar.gz
Running termcolor-1.1.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-YzwLtr/termcolor-1.1.0/egg-dist-tmp-GfHcKR
Traceback (most recent call last):
File "/usr/bin/easy_install", line 8, in <module>
load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1712, in main
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1700, in with_ei_usage
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1716, in <lambda>
File "/usr/lib/python2.5/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.5/distutils/dist.py", line 974, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.5/distutils/dist.py", line 994, in run_command
cmd_obj.run()
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 211, in run
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 35, in <module>
from termcolor import VERSION
File "/tmp/easy_install-YzwLtr/termcolor-1.1.0/termcolor.py", line 124
print((colored(text, color, on_color, attrs)), **kwargs)
^
SyntaxError: invalid syntax

Python GDAL: pip install --no-install GDAL fails

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

how to install python pgmagick on windows

I m trying to install pgmagick library on windows. I m following the official page:
http://pypi.python.org/pypi/pgmagick/
From there i can notice that i need to install first easy_install,pip, boost and graphicsMagic.
In this page i found easy_install:
http://blog.troygrosfield.com/2010/12/18/installing-easy_install-and-pip-for-python/
In this page i can find pip and boost:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pgmagick
But i can't figure out how to install magick++. I went to website and download it but it installs just the software and when i try to install pgmagick like this:
pip install pgmagick
there is an error that i need magick++:
F:\Python27\Scripts>easy_install -ZU pgmagick
Searching for pgmagick
Reading http://pypi.python.org/simple/pgmagick/
Reading http://bitbucket.org/hhatto/pgmagick
Best match: pgmagick 0.5.4
Downloading http://pypi.python.org/packages/source/p/pgmagick/pgmagick-0.5.4.tar
.gz#md5=c10a454331ac1c359b39e50663fd28e4
Processing pgmagick-0.5.4.tar.gz
Running pgmagick-0.5.4\setup.py -q bdist_egg --dist-dir f:\docume~1\alessa~1\imp
ost~1\temp\easy_install-xaypdo\pgmagick-0.5.4\egg-dist-tmp-qu7mji
Traceback (most recent call last):
File "F:\Python27\Scripts\easy_install-script.py", line 8, in <module>
load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
File "F:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
1712, in main
with_ei_usage(lambda:
File "F:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
1700, in with_ei_usage
return f()
File "F:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
1716, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "F:\Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "F:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "F:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "F:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
211, in run
self.easy_install(spec, not self.no_deps)
File "F:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
446, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "F:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
476, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "F:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
655, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "F:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
930, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "F:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
919, in run_setup
run_setup(setup_script, args)
File "F:\Python27\lib\site-packages\setuptools\sandbox.py", line 62, in run_se
tup
lambda: execfile(
File "F:\Python27\lib\site-packages\setuptools\sandbox.py", line 105, in run
return func()
File "F:\Python27\lib\site-packages\setuptools\sandbox.py", line 64, in <lambd
a>
{'__file__':setup_script, '__name__':'__main__'}
File "setup.py", line 74, in <module>
Exception: Magick++ not found
thanks!
I recommend you use the precompiled binary packages from the Unofficial Windows Binaries for Python Extension Packages (as mentioned in the pgmagick web page), instead of trying to compile from source which will be quite a complicated process.

Categories