How do I install scipy and numpy with setuptools - python

I am developing a python 3.4 module which has scipy and numpy as dependencies. So I declared them in my setup.py under install_requires.
Here is the minimum running example of my setup.py
from setuptools import setup
setup(
name='MyModule',
version='1.0.5',
author='Alexander Mueller',
packages=[],
scripts=[],
license='LICENSE.txt',
description='Stuff',
install_requires=[
"pandas == 0.15.2",
"scikit-learn==0.17",
"seaborn == 0.5.1",
"scipy == 0.17.0",
"numpy==1.10.4"
]
)
While running python setup.py install the following exception occurs.
However, when I install all those packages in order with pip install, no error occurs at all. Might be easy_install the problem?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "setup.py", line 16, in <module>
"numpy==1.10.4"
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/install.py", line 117, in do_egg_install
cmd.run()
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 380, in run
self.easy_install(spec, not self.no_deps)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 610, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 661, in install_item
self.process_distribution(spec, dist, deps)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 709, in process_distribution
[requirement], self.local_index, self.easy_install
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/pkg_resources/__init__.py", line 830, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/pkg_resources/__init__.py", line 1075, in best_match
return self.obtain(req, installer)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/pkg_resources/__init__.py", line 1087, in obtain
return installer(requirement)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 629, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 659, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 842, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1070, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1056, in run_setup
run_setup(setup_script, args)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 240, in run_setup
raise
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 193, in setup_context
yield
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 164, in save_modules
saved_exc.resume()
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 139, in resume
compat.reraise(type, exc, self._tb)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/compat.py", line 65, in reraise
raise value.with_traceback(tb)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 152, in save_modules
yield saved
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 193, in setup_context
yield
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 237, in run_setup
DirectorySandbox(setup_dir).run(runner)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 267, in run
return func()
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 236, in runner
_execfile(setup_script, ns)
File "/Users/alexandermueller/.virtualenvs/fpm_test3/lib/python3.4/site-packages/setuptools/sandbox.py", line 46, in _execfile
exec(code, globals, locals)
File "/var/folders/b0/_y4bfk6x4bldrmtycxhmbtrm0000gn/T/easy_install-drrk1iwn/scipy-0.17.0/setup.py", line 265, in <module>
File "/var/folders/b0/_y4bfk6x4bldrmtycxhmbtrm0000gn/T/easy_install-drrk1iwn/scipy-0.17.0/setup.py", line 253, in setup_package
ImportError: No module named 'numpy'
Thank you guys in advance.

Order seems to matter here, with this order the required packages were installed
install_requires=[
"numpy == 1.10.4",
"pandas == 0.15.2",
"seaborn == 0.5.1",
"scipy == 0.17.0",
"scikit-learn == 0.17"
]
Tested with pip3 1.5.4, xubuntu 14.04

Related

Pip seems not to be installing module in setup.py

I have a setup.py file that looks like this:
from setuptools import setup
setup(
name='yeet',
install_requires=[
'cmake>=3.15.3',
'Cython>=0.29.21',
'glob2>=0.6',
'hdbscan>=0.8.24',
],
)
When I run python setup.py install using a Python 3.7 conda environment, I get:
Traceback (most recent call last):
File "setup.py", line 66, in <module>
'pixplot=pixplot:parse',
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/command/install.py", line 117, in do_egg_install
cmd.run(show_deprecation=False)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 408, in run
self.easy_install(spec, not self.no_deps)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 650, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 697, in install_item
self.process_distribution(spec, dist, deps)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 742, in process_distribution
[requirement], self.local_index, self.easy_install
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 766, in resolve
replace_conflicting=replace_conflicting
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1049, in best_match
return self.obtain(req, installer)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1061, in obtain
return installer(requirement)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 669, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 695, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 880, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 1150, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 1134, in run_setup
run_setup(setup_script, args)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/sandbox.py", line 257, in run_setup
raise
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/contextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/sandbox.py", line 193, in setup_context
yield
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/contextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/sandbox.py", line 164, in save_modules
saved_exc.resume()
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/sandbox.py", line 139, in resume
raise exc.with_traceback(self._tb)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/sandbox.py", line 152, in save_modules
yield saved
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/sandbox.py", line 193, in setup_context
yield
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/sandbox.py", line 254, in run_setup
_execfile(setup_script, ns)
File "/Users/doug/anaconda/envs/3.7/lib/python3.7/site-packages/setuptools/sandbox.py", line 43, in _execfile
exec(code, globals, locals)
File "/var/folders/cy/ywx04ttn12n_xmgjf5s6sbzr0000gn/T/easy_install-ogn8e84n/hdbscan-0.8.26/setup.py", line 94, in <module>
ImportError: Cython not found! Please install cython and try again
Does anyone know why Cython isn't installed, given the fact that it's in my setup.py file? I know I can install Cython, but I'd like to prevent users from hitting this snag. Is the solution here for hdbscan to add Cython to its list of dependencies? Any pointers others can offer would be hugely appreciated!
I think you should try something like this.
from setuptools import setup, Extension
setup(
...
setup_requires=[
'setuptools>= 50.3.0',
'cython',
or something like this.
from setuptools import dist
dist.Distribution().fetch_build_eggs('Cython>=0.29.21')
Look in to the following post for more details.
https://luminousmen.com/post/resolve-cython-and-numpy-dependencies

Can't install modules? "ModuleNotFoundError: No Module Named Cython"

I have just installed python 3.8 and am using pycharm community edition as an interface. This has not happened previously, but when I install "pandas" module i receive the following error:
Executed command:
pip install pandas
"Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at 'C:\Users\SMafl\PycharmProjects\venv\Scripts\python.exe'.
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\dist.py", line 721, in fetch_build_eggs
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\pkg_resources\__init__.py", line 780, in resolve
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\pkg_resources\__init__.py", line 1065, in best_match
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\pkg_resources\__init__.py", line 1077, in obtain
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\dist.py", line 791, in fetch_build_egg
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\command\easy_install.py", line 679, in easy_install
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\command\easy_install.py", line 705, in install_item
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\command\easy_install.py", line 890, in install_eggs
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\command\easy_install.py", line 1158, in build_and_install
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\command\easy_install.py", line 1144, in run_setup
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\sandbox.py", line 253, in run_setup
File "C:\Users\SMafl\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\sandbox.py", line 195, in setup_context
File "C:\Users\SMafl\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\sandbox.py", line 166, in save_modules
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\sandbox.py", line 141, in resume
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\_vendor\six.py", line 685, in reraise
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\sandbox.py", line 154, in save_modules
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\sandbox.py", line 195, in setup_context
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\sandbox.py", line 250, in run_setup
File "C:\Users\SMafl\PycharmProjects\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\sandbox.py", line 45, in _execfile
File "C:\Users\SMafl\AppData\Local\Temp\easy_install-av09bwyr\numpy-1.18.0\setup.py", line 450, in <module>
File "C:\Users\SMafl\AppData\Local\Temp\easy_install-av09bwyr\numpy-1.18.0\setup.py", line 433, in setup_package
def finalize_options(self):
File "C:\Users\SMafl\AppData\Local\Temp\easy_install-av09bwyr\numpy-1.18.0\setup.py", line 240, in generate_cython
"""Custom distutils command to clean the .so and .pyc files."""
RuntimeError: Running cythonize failed!
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\SMafl\AppData\Local\Temp\pycharm-packaging\pandas\

Error while installing Pillow on a Raspberry Pi

I just was trying to install yowsup on my new Raspberry Pi. Everything went fine, until it was about to install Pillow. I got the following error message:
Processing dependencies for yowsup2==2.4
Searching for pillow
Reading http://pypi.python.org/simple/pillow/
Best match: Pillow 3.0.0
Downloading https://pypi.python.org/packages/source/P/Pillow/Pillow-3.0.0.zip#md5=dd81f6cc3f3a5e5fe72f0f1d936339c3
Processing Pillow-3.0.0.zip
Running Pillow-3.0.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-AlZEzs/Pillow-3.0.0/egg-dist-tmp-rX2XN3
Exception in thread Thread-1 (most likely raised during interpreter shutdown):Exception in thread Thread-2 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_innerTraceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 505, in run File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
File "/usr/lib/python2.7/multiprocessing/pool.py", line 353, in _handle_tasks File "/usr/lib/python2.7/threading.py", line 505, in run
File "/usr/lib/python2.7/multiprocessing/pool.py", line 329, in _handle_workers
<type 'exceptions.TypeError'>: 'NoneType' object is not callable
Exception
TypeError<type 'exceptions.TypeError'>: 'NoneType' object is not callable
: TypeError("'NoneType' object does not support item deletion",) in <Finalize object, dead> ignored
Traceback (most recent call last):
File "setup.py", line 42, in <module>
'Topic :: Software Development :: Libraries :: Python Modules'
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 73, in run
self.do_egg_install()
File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 101, in do_egg_install
cmd.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 368, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 588, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 640, in install_item
self.process_distribution(spec, dist, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 692, in process_distribution
[requirement], self.local_index, self.easy_install
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 576, in resolve
dist = best[req.key] = env.best_match(req, self, installer)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 821, in best_match
return self.obtain(req, installer) # try and download/install
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 833, in obtain
return installer(requirement)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 608, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 638, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 828, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1105, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1094, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 30, in run_setup
lambda: execfile(
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 72, in run
return func()
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 32, in <lambda>
{'__file__':setup_script, '__name__':'__main__'}
File "setup.py", line 767, in <module>
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/bdist_egg.py", line 179, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "/usr/lib/python2.7/dist-packages/setuptools/command/bdist_egg.py", line 166, in call_command
self.run_command(cmdname)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/install_lib.py", line 20, in run
self.build()
File "/usr/lib/python2.7/distutils/command/install_lib.py", line 111, in build
self.run_command('build_ext')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "setup.py", line 515, in build_extensions
ValueError: --enable-jpeg requested but jpeg not found, aborting.
I googeled it for at least an hour, but couldn't find a correct answer. Do you have any suggestions for me?
So it looks like you're trying to install PIL without the proper packages installed beforehand. Try installing libjpeg.
sudo apt-get install libjpeg-dev
If you look at the External Libraries section of the Pillow docs, you'll see that there are a number of libraries that should be present, including libjpeg and zlib. If you don't want JPEG support, you should download the "source" archive from PyPI, unzip it, then in the resulting directory run python setup.py install --disable-jpeg.
However, I wouldn't recommend this, as you won't be able to process JPEGs with Pillow. Instead, use the package manager on your Pi to install all of the libraries for which you'd like support, then re-run pip install pillow.

Installing trepan debugger for Python 3 on Ubuntu 14.04

I am using Ubuntu 14.04 with Python version 2.7.6. I recently installed Python version 3.4.2 side-by-side with the system Python using pyenv. Now I would like to test out some debuggers for Python 3, and I downloaded trepan-0.2.8-py3.3.egg from the python3-trepan project page.
Then I ran pyenv global 3.4.2 and easy_install trepan-0.2.8-py3.3.egg, which gave me the following error:
Traceback (most recent call last):
File "/home/hakon/.pyenv/versions/3.4.2/bin/easy_install", line 11, in <module>
sys.exit(main())
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1909, in main
with_ei_usage(lambda:
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1896, in with_ei_usage
return f()
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1913, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 358, in run
self.easy_install(spec, not self.no_deps)
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 574, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 625, in install_item
self.process_distribution(spec, dist, deps)
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 671, in process_distribution
[requirement], self.local_index, self.easy_install
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/pkg_resources.py", line 564, in resolve
dist = best[req.key] = env.best_match(req, self, installer)
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/pkg_resources.py", line 802, in best_match
return self.obtain(req, installer) # try and download/install
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/pkg_resources.py", line 814, in obtain
return installer(requirement)
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 593, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 623, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 809, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1015, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1000, in run_setup
run_setup(setup_script, args)
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/sandbox.py", line 50, in run_setup
lambda: execfile(
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/sandbox.py", line 100, in run
return func()
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/sandbox.py", line 52, in <lambda>
{'__file__':setup_script, '__name__':'__main__'}
File "/home/hakon/.pyenv/versions/3.4.2/lib/python3.4/site-packages/setuptools/compat.py", line 78, in execfile
exec(compile(source, fn, 'exec'), globs, locs)
File "setup.py", line 12, in <module>
ImportError: No module named '__pkginfo__'
Update:
The problem seems not to be related to installing Python 3 using pyenv: I tried the following:
disabled pyenv
sudo apt-get install python3 python
sudo apt-get install python3-setuptools
sudo easy_install-3.4 trepan-0.2.8-py3.3.egg
This gave me the same error:
Traceback (most recent call last):
File "/usr/bin/easy_install-3.4", line 9, in <module>
load_entry_point('setuptools==3.3', 'console_scripts', 'easy_install-3.4')()
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1963, in main
with_ei_usage(lambda:
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1950, in with_ei_usage
return f()
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1967, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "/usr/lib/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 381, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 597, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 648, in install_item
self.process_distribution(spec, dist, deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 694, in process_distribution
[requirement], self.local_index, self.easy_install
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 620, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 858, in best_match
return self.obtain(req, installer) # try and download/install
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 870, in obtain
return installer(requirement)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 616, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 646, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 834, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1040, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1025, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 50, in run_setup
lambda: execfile(
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 100, in run
return func()
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 52, in <lambda>
{'__file__':setup_script, '__name__':'__main__'}
File "/usr/lib/python3/dist-packages/setuptools/compat.py", line 78, in execfile
exec(compile(source, fn, 'exec'), globs, locs)
File "setup.py", line 12, in <module>
ImportError: No module named '__pkginfo__'
Starting with trepan 0.4.2 (at this writing we are at 0.4.7), the pip problems were addressed. However...
You are using pyenv but note that on Ubuntu 14.04 without that, you may need to use pip3 instead of pip. Outside of pyenv I think defaults pip to Python2's pip. See also this link.
And alas, there is another weirdness. When a wheel is not available (as was the case before version 0.4.7), pip uses the source tarball to install from rather than an egg. However the source code for Python 2 versus Python 3 is necessarily different and it would be too difficult to try to combine these into one source.
So, I have started to put wheel format file on pypi.org and I hope this too will address problems like this in the future.
I haven't tested it, but the maintainer #rocky recommends this to install:
pip3 install trepan3k
OLD:
Install using this command:
pip3 install -e git+https://github.com/rocky/python3-trepan/#egg=trepan
I think the current tarball/eggs are broken
You might take a look at https://askubuntu.com/questions/95037/what-is-the-best-way-to-install-python-packages or https://askubuntu.com/questions/350437/installing-python-modules-on-ubuntu or Installing python modules on Ubuntu
This just might solve the problem. Hope it helps.

easy_install on Cygwin: unittest2 causes SyntaxError

I'm trying to install unittest2 for Cygwin. I expect I'm missing something relatively simple, but I don't know what it is.
$ easy_install --version
distribute 0.6.34
$ python --version
Python 3.2.5
When I try to easy_install unittest2, I get the following output:
$ easy_install -U unittest2
Searching for unittest2
Reading http://pypi.python.org/simple/unittest2/
Best match: unittest2 0.5.1
Downloading https://pypi.python.org/packages/source/u/unittest2/unittest2-0.5.1.zip#md5=1527fb89e38343945af1166342d851ee
Processing unittest2-0.5.1.zip
Writing /tmp/easy_install-ncoq7f/unittest2-0.5.1/setup.cfg
Running unittest2-0.5.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ncoq7f/unittest2-0.5.1/egg-dist-tmp-ecnv6z
Traceback (most recent call last):
File "/usr/bin/easy_install", line 9, in <module>
load_entry_point('distribute==0.6.34', 'console_scripts', 'easy_install')()
File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 1937, in main
with_ei_usage(lambda:
File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 1918, in with_ei_usage
return f()
File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 1941, 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.2/site-packages/setuptools/command/easy_install.py", line 358, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 598, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 628, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 823, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 1103, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 1089, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python3.2/site-packages/setuptools/sandbox.py", line 34, in run_setup
lambda: exec(compile(open(
File "/usr/lib/python3.2/site-packages/setuptools/sandbox.py", line 82, in run
return func()
File "/usr/lib/python3.2/site-packages/setuptools/sandbox.py", line 37, in <lambda>
{'__file__':setup_script, '__name__':'__main__'})
File "setup.py", line 12, in <module>
File "/tmp/easy_install-ncoq7f/unittest2-0.5.1/unittest2/__init__.py", line 40, in <module>
File "/tmp/easy_install-ncoq7f/unittest2-0.5.1/unittest2/collector.py", line 3, in <module>
File "/tmp/easy_install-ncoq7f/unittest2-0.5.1/unittest2/loader.py", line 92
except Exception, e:
^
SyntaxError: invalid syntax
What's going on?
Try easy_install unittest2py3k (https://pypi.python.org/pypi/unittest2py3k). The error you are receiving is due to a change in syntax between in Python 3 (http://docs.pythonsprints.com/python3_porting/py-porting.html#exceptions)

Categories