Error when installing rpy2 module in Python with easy_install - python

I've been trying to install the rpy2 module so I can use R functions inside my Python script, but I'm getting an error after following the advice from these pages:
1) Tried to guess R's HOME but no R command in the PATH. OsX 10.6
2) http://rpy.sourceforge.net/rpy2/doc-dev/html/overview.html
What I've done so far:
1) Edited my path environment variable to include "C:\Program Files\R\R-3.1.0\bin\x64;"
2) Created a new environment variable called "R_HOME" and set its value to "C:\Program Files\R\R-3.1.0"
3) Created a new environment variable called "R_USER" and set its value to "Hefin" (my windows username)
Then in my command prompt I type:
easy_install rpy2
As far as I'm aware, easy_install is setup and installed correctly.
The output I get is:
Searching for rpy2
Reading https://pypi.python.org/simple/rpy2/
Best match: rpy2 2.5.5
Downloading https://pypi.python.org/packages/source/r/rpy2/rpy2-2.5.5.tar.gz#md5=c874bebbe775e3cdc926a1da00252c37
Processing rpy2-2.5.5.tar.gz
Writing C:\Users\Hefin\AppData\Local\Temp\easy_install-98mu0_xn\rpy2-2.5.5\setup.cfg
Running rpy2-2.5.5\setup.py -q bdist_egg --dist-dir C:\Users\Hefin\AppData\Local\Temp\easy_install-98mu0_xn\rpy2-2.5.5\egg-dist-tmp-00qpf_z8
The system cannot find the path specified.
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 150, in save_modules
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 191, in setup_context
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 235, in run_setup
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 265, in run
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 234, in runner
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 46, in _execfile
File "C:\Users\Hefin\AppData\Local\Temp\easy_install-98mu0_xn\rpy2-2.5.5\setup.py", line 282, in <module>
File "C:\Users\Hefin\AppData\Local\Temp\easy_install-98mu0_xn\rpy2-2.5.5\setup.py", line 185, in getRinterface_ext
File "C:\Users\Hefin\AppData\Local\Temp\easy_install-98mu0_xn\rpy2-2.5.5\setup.py", line 106, in version
File "C:\Python34\lib\subprocess.py", line 620, in check_output
raise CalledProcessError(retcode, process.args, output=output)
subprocess.CalledProcessError: Command '('C:\\PROGRA~1\\R\\R-31~1.0\\bin\\R', '--version')' returned non-zero exit status 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python34\Scripts\easy_install-script.py", line 9, in <module>
load_entry_point('setuptools==12.0.5', 'console_scripts', 'easy_install')()
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\command\easy_install.py", line 2244, in main
File "C:\Python34\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\command\easy_install.py", line 374, in run
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\command\easy_install.py", line 623, in easy_install
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\command\easy_install.py", line 653, in install_item
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\command\easy_install.py", line 838, in install_eggs
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\command\easy_install.py", line 1066, in build_and_install
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\command\easy_install.py", line 1052, in run_setup
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 238, in run_setup
File "C:\Python34\lib\contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 191, in setup_context
File "C:\Python34\lib\contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 162, in save_modules
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 137, in resume
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\compat.py", line 65, in reraise
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 150, in save_modules
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 191, in setup_context
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 235, in run_setup
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 265, in run
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 234, in runner
File "C:\Python34\lib\site-packages\setuptools-12.0.5-py3.4.egg\setuptools\sandbox.py", line 46, in _execfile
File "C:\Users\Hefin\AppData\Local\Temp\easy_install-98mu0_xn\rpy2-2.5.5\setup.py", line 282, in <module>
File "C:\Users\Hefin\AppData\Local\Temp\easy_install-98mu0_xn\rpy2-2.5.5\setup.py", line 185, in getRinterface_ext
File "C:\Users\Hefin\AppData\Local\Temp\easy_install-98mu0_xn\rpy2-2.5.5\setup.py", line 106, in version
File "C:\Python34\lib\subprocess.py", line 620, in check_output
raise CalledProcessError(retcode, process.args, output=output)
subprocess.CalledProcessError: Command '('C:\\PROGRA~1\\R\\R-31~1.0\\bin\\R', '--version')' returned non-zero exit status 1
C:\Users\Hefin>
Sorry it's so verbose! If I then invoke python and try to import the rpy module, I get:
>>> import python
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'python'
>>>
I'm afraid I'm new to Python and I don't know what I'm doing wrong. I've searched through previous forum posts, but none seem to have this problem. I'm using a 64bit machine with Windows 7, Python3.4 and R3.1.0.
Any help or thoughts would be much appreciated as I'm sure it's just something simple I'm doing wrong.
Thank you!
Hefin

There's a much easier way to go about this - install rpy2 from Christoph Gohlke's Python Extension Packages for Windows repository here. Download the rpy2‑2.5.5‑cp34‑none‑win_amd64.whl file (the current version at the time of this writing), change to the download folder on the command line, and run
pip install rpy2‑2.5.5‑cp34‑none‑win_amd64.whl
pip is already included in Python 3.4, and should be used instead of easy_install when installing new modules, as easy_install is deprecated.

Installing rpy2 on windows is straight forward using conda
conda install rpy2

Related

Problems installing signal processing and machine learning toolbox Bob

I'm trying to install the package from: https://gitlab.idiap.ch/bob/bob.paper.ijcb2021_vision_transformer_pad.
I had to edit the spec-file.txt to update the missing links with the earliest version available from each package and also modified the buildout file to connect via http instead of ssh. I working with conda + mamba in Ubuntu 20.04 and bob.extension is installed, however I can't get past this point when running buildout. Any tips on how to fix this? Thank you.
Here is the prompt I get with buildout:
mr.developer: Queued 'bob.db.hqwmca' for checkout.
mr.developer: Queued 'bob.io.stream' for checkout.
mr.developer: Queued 'bob.ip.stereo' for checkout.
mr.developer: Skipped checkout of existing package 'bob.db.hqwmca'.
mr.developer: Skipped checkout of existing package 'bob.io.stream'.
mr.developer: Skipped checkout of existing package 'bob.ip.stereo'.
Develop: '/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/src/bob.io.stream'
bob.buildout.tools: taking requirement `setuptools' (45.2.0) from `/usr/lib/python3/dist-packages'
bob.buildout.tools: taking requirement `numpy' (1.22.1) from `/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/eggs/numpy-1.22.1-py3.8-linux-x86_64.egg'
bob.buildout.tools: taking requirement `scipy' (1.7.3) from `/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/eggs/scipy-1.7.3-py3.8-linux-x86_64.egg'
bob.buildout.tools: Installing `bob.io.base' for package `/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/src/bob.io.stream'...
Getting distribution for 'bob.io.base'.
WARNING: The easy_install command is deprecated and will be removed in a future version.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-taijyg5a/bob.io.base-4.0.0/setup.py", line 10, in <module>
ModuleNotFoundError: No module named 'bob.extension'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 2372, in main
setup(
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 450, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 693, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 738, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 923, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1191, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1177, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python3/dist-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 "/usr/lib/python3/dist-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 "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 166, in save_modules
saved_exc.resume()
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "/usr/lib/python3/dist-packages/setuptools/_vendor/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-taijyg5a/bob.io.base-4.0.0/setup.py", line 10, in <module>
ModuleNotFoundError: No module named 'bob.extension'
An error occurred when trying to install /tmp/tmpo3qzby_8get_dist/bob.io.base-4.0.0.zip. Look above this message for any errors that were output by easy_install.
While:
Installing.
Processing develop directory '/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/src/bob.io.stream'.
Getting distribution for 'bob.io.base'.
An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/zc/buildout/buildout.py", line 2174, in main
getattr(buildout, command)(args)
File "/usr/lib/python3/dist-packages/zc/buildout/buildout.py", line 679, in install
installed_develop_eggs = self._develop()
File "/usr/lib/python3/dist-packages/zc/buildout/buildout.py", line 922, in _develop
zc.buildout.easy_install.develop(setup, dest)
File "/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/eggs/bob.buildout-2.3.0-py3.8.egg/bob/buildout/extension.py", line 170, in develop
tools.satisfy_requirements(self.buildout, directory, working_set)
File "/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/eggs/bob.buildout-2.3.0-py3.8.egg/bob/buildout/tools.py", line 231, in satisfy_requirements
working_set = install_package(buildout, req, working_set)
File "/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/eggs/bob.buildout-2.3.0-py3.8.egg/bob/buildout/tools.py", line 200, in install_package
new_ws = zc.buildout.easy_install.install(
File "/usr/lib/python3/dist-packages/zc/buildout/easy_install.py", line 957, in install
return installer.install(specs, working_set)
File "/usr/lib/python3/dist-packages/zc/buildout/easy_install.py", line 682, in install
for dist in self._get_dist(requirement, ws):
File "/usr/lib/python3/dist-packages/zc/buildout/easy_install.py", line 574, in _get_dist
dists = [_move_to_eggs_dir_and_compile(dist, self._dest)]
File "/usr/lib/python3/dist-packages/zc/buildout/easy_install.py", line 1745, in _move_to_eggs_dir_and_compile
[tmp_loc] = glob.glob(os.path.join(tmp_dest, '*'))
ValueError: not enough values to unpack (expected 1, got 0)
From your comment it seems you have a lot of different Python versions installed; 2.7, 3.6, 3.7 and 3.8.
Normally, having multiple versions of Python 3 installed is not a problem in and of itself. But it can lead to mistakes.
Especially since there usually is a python3 link that can only point to one version.
So what I suspect that happened is that you installed bob.extensions for a different Python version then the one you are using for bob.paper.
Or you installed it in a different virtual environment (if you are using those)!
My recommendation is to check if you really need all the different versions. If not, note down which packages you have installed for the different Python version and decide which ones you need.
Then delete all Python versions except 3.8, and make sure that there is a link python3 pointing to python3.8.
Then install all the prequisites and bob.extensions and bob.paper on that.
I've never used conda on a non-windows machine, and normally I would advise to stick with python from python.org, or whatever your distribution has packages for.

Exceptions when installing lxml

On Mac OS 10.14.6, I'm trying to install lxml for Python 3.6 with:
> STATIC_DEPS=true easy_install-3.6 lxml
I get this exception:
Exception: Command "./configure --prefix=/private/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/build/tmp/libxml2" returned code 1
Here's the entire trace I get:
Searching for lxml Reading https://pypi.python.org/simple/lxml/
Downloading
https://files.pythonhosted.org/packages/03/a8/73d795778143be51d8b86750b371b3efcd7139987f71618ad9f4b8b65543/lxml-4.5.1.tar.gz#sha256=27ee0faf8077c7c1a589573b1450743011117f1aa1a91d5ae776bbc5ca6070f2
Best match: lxml 4.5.1 Processing lxml-4.5.1.tar.gz Writing
/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/setup.cfg
Running lxml-4.5.1/setup.py -q bdist_egg --dist-dir
/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/egg-dist-tmp-mnc4h10m
Building lxml version 4.5.1. Latest version of zlib is 1.2.11
Downloading zlib into libs/zlib-1.2.11.tar.gz from
https://zlib.net/zlib-1.2.11.tar.gz Unpacking zlib-1.2.11.tar.gz into
build/tmp Latest version of libiconv is 1.16 Downloading libiconv into
libs/libiconv-1.16.tar.gz from
https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz Unpacking
libiconv-1.16.tar.gz into build/tmp Latest version of libxml2 is
2.9.10 Downloading libxml2 into libs/libxml2-2.9.10.tar.gz from http://xmlsoft.org/sources/libxml2-2.9.10.tar.gz Unpacking
libxml2-2.9.10.tar.gz into build/tmp Latest version of libxslt is
1.1.34 Downloading libxslt into libs/libxslt-1.1.34.tar.gz from http://xmlsoft.org/sources/libxslt-1.1.34.tar.gz Unpacking
libxslt-1.1.34.tar.gz into build/tmp Starting build in
build/tmp/zlib-1.2.11 Checking for gcc... Compiler error reporting is
too harsh for ./configure (perhaps remove -Werror).
** ./configure aborting. Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 157, in save_modules
yield saved File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 198, in setup_context
yield File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 248, in run_setup
DirectorySandbox(setup_dir).run(runner) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 278, in run
return func() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 246, in runner
_execfile(setup_script, ns) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 47, in _execfile
exec(code, globals, locals) File "/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/setup.py",
line 245, in File
"/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/setup.py",
line 153, in setup_extra_options File
"/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/setupinfo.py",
line 82, in ext_modules File
"/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/buildlibxml.py",
line 391, in build_libxml2xslt File
"/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/buildlibxml.py",
line 330, in cmmi File
"/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/buildlibxml.py",
line 320, in call_subprocess Exception: Command "./configure
--prefix=/private/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/build/tmp/libxml2"
returned code 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"/Library/Frameworks/Python.framework/Versions/3.6/bin/easy_install-3.6",
line 11, in
sys.exit(main()) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/easy_install.py",
line 2265, in main
**kw File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py",
line 148, in setup
dist.run_commands() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py",
line 955, in run_commands
self.run_command(cmd) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py",
line 974, in run_command
cmd_obj.run() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/easy_install.py",
line 410, in run
self.easy_install(spec, not self.no_deps) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/easy_install.py",
line 665, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/easy_install.py",
line 695, in install_item
dists = self.install_eggs(spec, download, tmpdir) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/easy_install.py",
line 876, in install_eggs
return self.build_and_install(setup_script, setup_base) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/easy_install.py",
line 1115, in build_and_install
self.run_setup(setup_script, setup_base, args) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/command/easy_install.py",
line 1101, in run_setup
run_setup(setup_script, args) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 251, in run_setup
raise File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py",
line 99, in exit
self.gen.throw(type, value, traceback) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 198, in setup_context
yield File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py",
line 99, in exit
self.gen.throw(type, value, traceback) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 169, in save_modules
saved_exc.resume() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 144, in resume
six.reraise(type, exc, self._tb) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pkg_resources/_vendor/six.py",
line 685, in reraise
raise value.with_traceback(tb) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 157, in save_modules
yield saved File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 198, in setup_context
yield File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 248, in run_setup
DirectorySandbox(setup_dir).run(runner) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 278, in run
return func() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 246, in runner
_execfile(setup_script, ns) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/sandbox.py",
line 47, in _execfile
exec(code, globals, locals) File "/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/setup.py",
line 245, in File
"/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/setup.py",
line 153, in setup_extra_options File
"/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/setupinfo.py",
line 82, in ext_modules File
"/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/buildlibxml.py",
line 391, in build_libxml2xslt File
"/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/buildlibxml.py",
line 330, in cmmi File
"/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/buildlibxml.py",
line 320, in call_subprocess Exception: Command "./configure
--prefix=/private/var/folders/yd/szy02nx52b912gvn2qhh8nb40000gq/T/easy_install-_ctp1edv/lxml-4.5.1/build/tmp/libxml2"
returned code 1
any help will appreciate!
tanks
Depending on your setup, you might install lxml with one of these commands:
$ apt-get install python-lxml
$ easy_install lxml
$ pip install lxml

Running Keras using theano

I have followd the link provided by Keras to download theano backend linkon windows (mine is windows 10). but when I import Kares. I got the followings:
Problem occurred during compilation with the command line below:
"C:\MinGW\bin\g++.exe" -shared -g -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"C:\Python27\lib\site-packages\numpy\core\include" -I"C:\Python27\include" -I"C:\Users\M\AppData\Roaming\Python\Python27\site-packages\theano\gof" -L"C:\Python27\libs" -L"C:\Python27" -o C:\Users\M\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.13-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\M\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.13-64\lazylinker_ext\mod.cpp -lpython27
Traceback (most recent call last):
File "C:\Users\M\Desktop\Experiment_Calculation.py", line 5, in <module>
import keras
File "C:\Users\M\AppData\Roaming\Python\Python27\site-packages\keras\__init__.py", line 3, in <module>
from . import activations
File "C:\Users\M\AppData\Roaming\Python\Python27\site-packages\keras\activations.py", line 4, in <module>
from . import backend as K
File "C:\Users\M\AppData\Roaming\Python\Python27\site-packages\keras\backend\__init__.py", line 70, in <module>
from .theano_backend import *
File "C:\Users\M\AppData\Roaming\Python\Python27\site-packages\keras\backend\theano_backend.py", line 3, in <module>
import theano
File "C:\Users\M\AppData\Roaming\Python\Python27\site-packages\theano\__init__.py", line 66, in <module>
from theano.compile import (
File "C:\Users\M\AppData\Roaming\Python\Python27\site-packages\theano\compile\__init__.py", line 10, in <module>
from theano.compile.function_module import *
File "C:\Users\M\AppData\Roaming\Python\Python27\site-packages\theano\compile\function_module.py", line 21, in <module>
import theano.compile.mode
File "C:\Users\M\AppData\Roaming\Python\Python27\site-packages\theano\compile\mode.py", line 10, in <module>
import theano.gof.vm
File "C:\Users\M\AppData\Roaming\Python\Python27\site-packages\theano\gof\vm.py", line 662, in <module>
from . import lazylinker_c
File "C:\Users\M\AppData\Roaming\Python\Python27\site-packages\theano\gof\lazylinker_c.py", line 127, in <module>
preargs=args)
File "C:\Users\M\AppData\Roaming\Python\Python27\site-packages\theano\gof\cmodule.py", line 2316, in compile_str
(status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): C:\Users\M\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.13-64\lazylinker_ext\mod.cpp:1:0: sorry, unimplemented: 64-bit mode not compiled in
. #include <Python.h>
. ^
.
I don't get the issue, Can Anyone please help with this problem?
I solved the above problem by editting the path enviroments, because I figured out that I have two version of Mingw. Thus, I removed the old one.
However, I got another error while downloading Kares following the link [link]
The error is as follows:
running develop
running egg_info
writing dependency_links to Keras.egg-info\dependency_links.txt
writing Keras.egg-info\PKG-INFO
writing requirements to Keras.egg-info\requires.txt
writing top-level names to Keras.egg-info\top_level.txt
reading manifest file 'Keras.egg-info\SOURCES.txt'
writing manifest file 'Keras.egg-info\SOURCES.txt'
running build_ext
Creating c:\python\python35\lib\site-packages\Keras.egg-link (link to .)
Keras 2.0.4 is already the active version in easy-install.pth
Installed c:\users\m\anaconda2\lib\site-packages\keras
Processing dependencies for Keras==2.0.4
Searching for scipy>=0.14
Reading https://pypi.python.org/simple/scipy/
Best match: scipy 0.19.0
Downloading https://pypi.python.org/packages/e5/93/9a8290e7eb5d4f7cb53b9a7ad7b92b9827ecceaddfd04c2a83f195d8767d/scipy-0.19.0.zip#md5=91b8396231eec780222a57703d3ec550
Processing scipy-0.19.0.zip
Writing C:\Users\M\AppData\Local\Temp\easy_install-dqpyaq0f\scipy-0.19.0\setup.cfg
Running scipy-0.19.0\setup.py -q bdist_egg --dist-dir
C:\Users\M\AppData\Local\Temp\easy_install-dqpyaq0f\scipy-0.19.0\egg-dist-tmp-ebc75q91
C:\Users\M\AppData\Local\Temp\easy_install-dqpyaq0f\scipy-0.19.0\setup.py:323: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
warnings.warn("Unrecognized setuptools command, proceeding with "
Traceback (most recent call last):
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
yield saved
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
yield
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 243, in run_setup
DirectorySandbox(setup_dir).run(runner)
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 273, in run
return func()
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 242, in runner
_execfile(setup_script, ns)
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 46, in _execfile
exec(code, globals, locals)
File "C:\Users\M\AppData\Local\Temp\easy_install-dqpyaq0f\scipy-0.19.0\setup.py", line 416, in <module>
File "C:\Users\M\AppData\Local\Temp\easy_install-dqpyaq0f\scipy-0.19.0\setup.py", line 396, in setup_package
ImportError: No module named 'numpy'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "setup.py", line 22, in <module>
packages=find_packages())
File "C:\Python\python35\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python\python35\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Python\python35\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python\python35\lib\site-packages\setuptools\command\develop.py", line 34, in run
self.install_for_development()
File "C:\Python\python35\lib\site-packages\setuptools\command\develop.py", line 133, in install_for_development
self.process_distribution(None, self.dist, not self.no_deps)
File "C:\Python\python35\lib\site-packages\setuptools\command\easy_install.py", line 717, in process_distribution
[requirement], self.local_index, self.easy_install
File "C:\Python\python35\lib\site-packages\pkg_resources\__init__.py", line 826, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "C:\Python\python35\lib\site-packages\pkg_resources\__init__.py", line 1092, in best_match
return self.obtain(req, installer)
File "C:\Python\python35\lib\site-packages\pkg_resources\__init__.py", line 1104, in obtain
return installer(requirement)
File "C:\Python\python35\lib\site-packages\setuptools\command\easy_install.py", line 640, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "C:\Python\python35\lib\site-packages\setuptools\command\easy_install.py", line 670, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "C:\Python\python35\lib\site-packages\setuptools\command\easy_install.py", line 850, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "C:\Python\python35\lib\site-packages\setuptools\command\easy_install.py", line 1078, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "C:\Python\python35\lib\site-packages\setuptools\command\easy_install.py", line 1064, in run_setup
run_setup(setup_script, args)
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 246, in run_setup
raise
File "C:\Python\python35\lib\contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
yield
File "C:\Python\python35\lib\contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 166, in save_modules
saved_exc.resume()
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "C:\Python\python35\lib\site-packages\pkg_resources\_vendor\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
yield saved
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
yield
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 243, in run_setup
DirectorySandbox(setup_dir).run(runner)
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 273, in run
return func()
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 242, in runner
_execfile(setup_script, ns)
File "C:\Python\python35\lib\site-packages\setuptools\sandbox.py", line 46, in _execfile
exec(code, globals, locals)
File "C:\Users\M\AppData\Local\Temp\easy_install-dqpyaq0f\scipy-0.19.0\setup.py", line 416, in <module>
File "C:\Users\M\AppData\Local\Temp\easy_install-dqpyaq0f\scipy-0.19.0\setup.py", line 396, in setup_package
ImportError: No module named 'numpy'
I don't know why is this occuring. I have numpy intalld already.
Any suggestions ?

How to set up a Virtual Environment for makerbot/s3g

I'm trying to get this module working:
https://github.com/makerbot/s3g
Their naming is a bit confusing, as the whole thing often gets referred to as "makerbot_driver" and there is also a subfolder called that.
I run into to trouble when I try to run the command:
python virtualenv.py virtualenv
When I try to run it in the makerbot_driver folder, as they suggest, I get this:
python: can't open file 'virtualenv.py': [Errno 2] No such file or directory
Which makes sense, as virtualenv.py is actually one folder up. However, when I go one folder up, and run the same command, it has a bit more success, but runs into a bunch of errors that I really can't seem to interpret:
New python executable in virtualenv/bin/python
Installing setuptools...................................
Complete output from command /home/jason/GitHub/s3g/virtualenv/bin/python -c "#!python
\"\"\"Bootstra...sys.argv[1:])
" /home/jason/GitHub/s...ols-0.6c11-py2.7.egg:
Traceback (most recent call last):
File "<string>", line 279, in <module>
File "<string>", line 240, in main
File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1712, in main
File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1700, in with_ei_usage
File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1716, in <lambda>
File "/usr/lib/python2.7/distutils/core.py", line 151, 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 971, in run_command
cmd_obj.ensure_finalized()
File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 125, in finalize_options
File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1121, in _expand
File "/usr/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
cmd_obj.ensure_finalized()
File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/home/jason/GitHub/s3g/setuptools-0.6c11-py2.7.egg/setuptools/command/install.py", line 32, in finalize_options
File "/usr/lib/python2.7/distutils/command/install.py", line 321, in finalize_options
(prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix')
File "/home/jason/GitHub/s3g/virtualenv/lib/python2.7/distutils/__init__.py", line 88, in sysconfig_get_config_vars
real_vars = old_get_config_vars(*args)
File "/usr/lib/python2.7/distutils/sysconfig.py", line 495, in get_config_vars
func()
File "/usr/lib/python2.7/distutils/sysconfig.py", line 439, in _init_posix
from _sysconfigdata import build_time_vars
File "/usr/lib/python2.7/_sysconfigdata.py", line 6, in <module>
from _sysconfigdata_nd import *
ImportError: No module named _sysconfigdata_nd
----------------------------------------
...Installing setuptools...done.
Traceback (most recent call last):
File "virtualenv.py", line 2270, in <module>
main()
File "virtualenv.py", line 928, in main
never_download=options.never_download)
File "virtualenv.py", line 1040, in create_environment
search_dirs=search_dirs, never_download=never_download)
File "virtualenv.py", line 593, in install_setuptools
search_dirs=search_dirs, never_download=never_download)
File "virtualenv.py", line 567, in _install_req
cwd=cwd)
File "virtualenv.py", line 1006, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/jason/GitHub/s3g/virtualenv/bin/python -c "#!python
\"\"\"Bootstra...sys.argv[1:])
" /home/jason/GitHub/s...ols-0.6c11-py2.7.egg failed with error code 1
I've tried to install things like the pyserial module they require and virtualenv, and that's all turned out fine, but this virtualenv thing just keeps going badly for me.
Any advice at all would be appreciated. Thanks.
That is a known bug in Ubuntu. Fix:
$ cd /usr/lib/python2.7
$ sudo ln -s plat-x86_64-linux-gnu/_sysconfigdata_nd.py .
Then it works.
$ python2.7 virtualenv.py virtualenv
New python executable in virtualenv/bin/python2.7
Not overwriting existing python script virtualenv/bin/python (you must use virtualenv/bin/python2.7)
Installing setuptools................................done.
Installing pip.....................done.

easy_install can't install package

I'm trying to write a setup.py file for my python project:
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
requires = [
'requests',
'simplejson',
'logging',
'rfc3987',
]
setup(name='xxxxxxx',
version='0.1',
description='xxxxxxx API',
url='https://github.com/xxxxxxxx',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=requires,
)
When I execute it I'm getting this error:
Searching for rfc3987
Reading http://pypi.python.org/simple/rfc3987/
Best match: rfc3987 1.3.1
Downloading https://pypi.python.org/packages/source/r/rfc3987/rfc3987-1.3.1.tar.gz#md5=397b1c1cd8b934269e53a621d56d9ed2
Processing rfc3987-1.3.1.tar.gz
Running rfc3987-1.3.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-AYV_bv/rfc3987-1.3.1/egg-dist-tmp-G8Kbay
Traceback (most recent call last):
File "/usr/bin/easy_install", line 9, in <module>
load_entry_point('distribute==0.6.10', 'console_scripts', 'easy_install')()
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 1715, in main
with_ei_usage(lambda:
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 1696, in with_ei_usage
return f()
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 1719, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 236, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 472, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 502, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 681, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 958, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 947, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 29, in run_setup
lambda: execfile(
File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 70, in run
return func()
File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 31, in <lambda>
{'__file__':setup_script, '__name__':'__main__'}
File "setup.py", line 4, in <module>
File "/tmp/easy_install-AYV_bv/rfc3987-1.3.1/rfc3987.py", line 324, in <module>
File "/tmp/easy_install-AYV_bv/rfc3987-1.3.1/rfc3987.py", line 323, in <genexpr>
File "/tmp/easy_install-AYV_bv/rfc3987-1.3.1/rfc3987.py", line 319, in _interpret_unicode_escapes
ValueError: zero length field name in format
If I try just easy_install rfc3987 I'm getting the same error.
Are there any ways to go around this?
rfc3987 claims that it works on Python 2.7 and 3.x. You're trying to install it on 2.6. So it fails.
The problem has nothing to do with your own package, or with easy_install. If you download the tarball manually and run python2.6 setup.py install, you get the same error. And in fact, at least in 1.3.1, there's code that clearly isn't legal under Python 2.6, like this function.
From the git history, it looks like there have been changes to make it Python 2.6 compatible, so the next release may work. Until then, you won't be able to use it from 2.6.

Categories

Resources