Problems importing magic on Windows 64-bit - python

I have searched on the internet for a solution to import magic correctly in Windows 10 64-bit. I found this, but I do not understand the solution.
It says to copy two DLLs into the specified path in the OS.
What does the below command mean?
file_magic = magic.Magic(magic_file="c:\path\to\magic.mgc")
Is the solution the combination of 1 + 2? Or just 1? I have done 1. Still getting an error. (the 1st error is solved)
>>> import magic
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\magic.py", line 176, in <modu
raise ImportError('failed to find libmagic. Check your install
ImportError: failed to find libmagic. Check your installation
Second Error I am getting
>>> import magic
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\magic\__init__.py", line 1, in <module>
from . import ffi
File "C:\Python27\lib\site-packages\magic\ffi.py", line 27, in <module>
ext_package="magic")
File "C:\Python27\lib\site-packages\cffi\api.py", line 437, in verify
lib = self.verifier.load_library()
File "C:\Python27\lib\site-packages\cffi\verifier.py", line 113, in load_library
self._compile_module()
File "C:\Python27\lib\site-packages\cffi\verifier.py", line 210, in _compile_module
outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
File "C:\Python27\lib\site-packages\cffi\ffiplatform.py", line 29, in compile
outputfilename = _build(tmpdir, ext, compiler_verbose)
File "C:\Python27\lib\site-packages\cffi\ffiplatform.py", line 55, in _build
dist.run_command('build_ext')
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\setuptools\command\build_ext.py", line 75, in run
_build_ext.run(self)
File "C:\Python27\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "C:\Python27\lib\distutils\command\build_ext.py", line 449, in build_extensions
self.build_extension(ext)
File "C:\Python27\lib\site-packages\setuptools\command\build_ext.py", line 196, in build_extension
_build_ext.build_extension(self, ext)
File "C:\Python27\lib\distutils\command\build_ext.py", line 499, in build_extension
depends=ext.depends)
File "C:\Python27\lib\distutils\msvc9compiler.py", line 473, in compile
self.initialize()
File "C:\Python27\lib\distutils\msvc9compiler.py", line 383, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python27\lib\site-packages\setuptools\msvc.py", line 136, in msvc9_query_vcvarsall
return EnvironmentInfo(arch, ver).return_env()
File "C:\Python27\lib\site-packages\setuptools\msvc.py", line 1097, in return_env
[self.VCIncludes,
File "C:\Python27\lib\site-packages\setuptools\msvc.py", line 805, in VCIncludes
return [os.path.join(self.si.VCInstallDir, 'Include'),
File "C:\Python27\lib\site-packages\setuptools\msvc.py", line 542, in VCInstallDir
raise distutils.errors.DistutilsPlatformError(msg)
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27

I think you are successfully completed Step 1. In 2nd step keep your magic.mgc file ( obtained by cloning of libmagicwin64) somewhere accessible by python script ( in the below case C:\Programs\libmagicwin64\ folder). then you can use like this...
>>> import magic
>>> file_magic = magic.Magic(magic_file="C:\Programs\libmagicwin64\magic.mgc")
>>> print(file_magic.from_file("D:\Work Folder\mcabcaaug2016.pdf"))
'PDF document, version 1.4'

Related

No module found 'references' when try to install models python package

I am going to work on a project done in 2020. They use pipenv to create an environment. The installation of the environment was well done, but when I try to run the "main" script I got an error:
Traceback (most recent call last):
File "eval.py", line 17, in <module>
from horsetrack.ModuleFactory import the_factory
File "/home/irina/horsetrack-core-ml/horsetrack/__init__.py", line 12, in <module>
from . import api
File "/home/irina/horsetrack-core-ml/horsetrack/api/__init__.py", line 11, in <module>
from . import cam
File "/home/irina/horsetrack-core-ml/horsetrack/api/cam/__init__.py", line 17, in <module>
from .CAMSequenceHandler import CAMSequenceHandler
File "/home/irina/horsetrack-core-ml/horsetrack/api/cam/CAMSequenceHandler.py", line 17, in <module>
import horsetrack.api.handlers as handlers
File "/home/irina/horsetrack-core-ml/horsetrack/api/handlers/__init__.py", line 12, in <module>
from .PartitionAggregateHandler import PartitionAggregateHandler
File "/home/irina/horsetrack-core-ml/horsetrack/api/handlers/PartitionAggregateHandler.py", line 28, in <module>
from .TimeseriesHandler import TimeseriesHandler
File "/home/irina/horsetrack-core-ml/horsetrack/api/handlers/TimeseriesHandler.py", line 14, in <module>
import horsetrack.cognitive_lab as cgl
File "/home/irina/horsetrack-core-ml/horsetrack/cognitive_lab/__init__.py", line 13, in <module>
from .CLExperiment import CLExperiment
File "/home/irina/horsetrack-core-ml/horsetrack/cognitive_lab/CLExperiment.py", line 20, in <module>
import echotorch
File "/home/irina/.local/share/virtualenvs/horsetrack-core-ml-8HwP1w-9/lib/python3.8/site-packages/echotorch/__init__.py", line 6, in <module>
import models
The official page suggest to use the following command to install such package:
easy_install models
I got another error: it does not install models since missing references module.. Search for such error on the web, but I didn't find anything.
Here the error:
Searching for models
Reading https://pypi.org/simple/models/
Downloading https://files.pythonhosted.org/packages/92/3c/ac1ddde60c02b5a46993bd3c6f4c66a9dbc100059da8333178ce17a22db5/models-0.9.3.tar.gz#sha256=b5aa29c6b57a667cda667dd9fbd33bbd15c14cc285e57dda64f4f4c0fd35e0ae
Best match: models 0.9.3
Processing models-0.9.3.tar.gz
Writing /tmp/easy_install-ths47zr2/models-0.9.3/setup.cfg
Running models-0.9.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ths47zr2/models-0.9.3/egg-dist-tmp-dkk5two0
Traceback (most recent call last):
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/sandbox.py", line 195, in setup_context yield
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-ths47zr2/models-0.9.3/setup.py", line 25, in <module>
File "/tmp/easy_install-ths47zr2/models-0.9.3/models/__init__.py", line 25, in <module>
ModuleNotFoundError: No module named 'references'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/irina/.pyenv/versions/3.8.2/bin/easy_install", line 10, in <module>
sys.exit(main())
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 2312, in main
setup(
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 418, in run
self.easy_install(spec, not self.no_deps)
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 679, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 705, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 890, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 1158, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 1144, in run_setup
run_setup(setup_script, args)
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/sandbox.py", line 253, in run_setup
raise
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/sandbox.py", line 195, in setup_context yield
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/sandbox.py", line 166, in save_modules
saved_exc.resume()
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/sandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/_vendor/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/sandbox.py", line 195, in setup_context yield
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/home/irina/.pyenv/versions/3.8.2/lib/python3.8/site-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-ths47zr2/models-0.9.3/setup.py", line 25, in <module>
File "/tmp/easy_install-ths47zr2/models-0.9.3/models/__init__.py", line 25, in <module>
ModuleNotFoundError: No module named 'references'
Any idea to solve it?
Thanks in advance

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 ?

Error when installing rpy2 module in Python with easy_install

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

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.

Unable to find vcvarsall.bat

I am trying to run a python project that I have not written myself. This has required me to install a series of new libraries, but more importantly, it has required me to install Cython.
I think I've installed Cython succesfully at this point. I am using MinGW for my compiler. When I try to run the project I get the error
ImportError: Building module RayTrace failed: ['DistutilsPlatformError: Unable to find vcvarsall.bat\n']
As far as I've understood this is about setting the path for the compiler. I have created the distutils.cfg file that says MinGW is the compiler as well as put MinGW in Path.
Where do I go from here?
this is the complete traceback:
Traceback (most recent call last):
File "C:\Users\Marten\Python\DisperseIt\DisperseIt.py", line 5, in <module>
from DisperseProjectDisperseCtrlFrame import *
File "C:\Users\Marten\Python\DisperseIt\DisperseProjectDisperseCtrlFrame.py", line 12, in <module>
import SectionCalc
File "C:\Users\Marten\Python\DisperseIt\SectionCalc.py", line 10, in <module>
from RayTrace import CalcIndices
File "C:\Python27\lib\site-packages\cython-0.20.2-py2.7-win32.egg\pyximport\pyximport.py", line 431, in load_module
language_level=self.language_level)
File "C:\Python27\lib\site-packages\cython-0.20.2-py2.7-win32.egg\pyximport\pyximport.py", line 209, in load_module
inplace=build_inplace, language_level=language_level)
File "C:\Python27\lib\site-packages\cython-0.20.2-py2.7-win32.egg\pyximport\pyximport.py", line 186, in build_module
reload_support=pyxargs.reload_support)
File "C:\Python27\lib\site-packages\cython-0.20.2-py2.7-win32.egg\pyximport\pyxbuild.py", line 104, in pyx_to_dll
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\cython-0.20.2-py2.7-win32.egg\Cython\Distutils\build_ext.py", line 163, in run
_build_ext.build_ext.run(self)
File "C:\Python27\lib\distutils\command\build_ext.py", line 337, in run
self.build_extensions()
File "C:\Python27\lib\site-packages\cython-0.20.2-py2.7-win32.egg\Cython\Distutils\build_ext.py", line 171, in build_extensions
self.build_extension(ext)
File "C:\Python27\lib\distutils\command\build_ext.py", line 496, in build_extension
depends=ext.depends)
File "C:\Python27\lib\distutils\msvc9compiler.py", line 473, in compile
self.initialize()
File "C:\Python27\lib\distutils\msvc9compiler.py", line 383, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python27\lib\distutils\msvc9compiler.py", line 271, in query_vcvarsall
raise DistutilsPlatformError("Unable to find vcvarsall.bat")
ImportError: Building module RayTrace failed: ['DistutilsPlatformError: Unable to find vcvarsall.bat\n']

Categories

Resources