Error while installing virtualenvwrapper [duplicate] - python

This question already has answers here:
IPython Notebook locale error [duplicate]
(4 answers)
Closed 6 years ago.
I've tried everything and I can't install virtualenvwrapper.
I have installed python 2.7.6 and virtualenv.
I'm using MacOSX Mavericks.
When I try to install with pip install virtualenvwrapper or sudo pip install virtualenvwrapper came with this error.
Downloading virtualenvwrapper-4.2.tar.gz (125kB): 125kB downloaded
Running setup.py egg_info for package virtualenvwrapper
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/private/var/folders/hl/n7326xr91ls3z8c3s08_dv4r0000gn/T/pip_build_rafagomes/virtualenvwrapper/setup.py", line 7, in <module>
pbr=True,
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/dist.py", line 239, in __init__
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/dist.py", line 263, in fetch_build_eggs
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 564, in resolve
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 802, in best_match
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 814, in obtain
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/dist.py", line 313, in fetch_build_egg
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/command/easy_install.py", line 593, in easy_install
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/command/easy_install.py", line 623, in install_item
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/command/easy_install.py", line 809, in install_eggs
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/command/easy_install.py", line 1015, in build_and_install
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/command/easy_install.py", line 1000, in run_setup
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/sandbox.py", line 50, in run_setup
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/sandbox.py", line 100, in run
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/sandbox.py", line 52, in <lambda>
File "setup.py", line 22, in <module>
File "/var/folders/hl/n7326xr91ls3z8c3s08_dv4r0000gn/T/easy_install-fh8Xd1/pbr-0.5.23/pbr/util.py", line 259, in cfg_to_args
File "/var/folders/hl/n7326xr91ls3z8c3s08_dv4r0000gn/T/easy_install-fh8Xd1/pbr-0.5.23/pbr/util.py", line 480, in wrap_commands
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 772, in get_command_list
klass = self.get_command_class(cmd)
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/dist.py", line 366, in get_command_class
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 815, in get_command_class
__import__ (module_name)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/check.py", line 13, in <module>
from docutils.utils import Reporter
File "/Library/Python/2.7/site-packages/docutils/utils/__init__.py", line 20, in <module>
from docutils.io import FileOutput
File "/Library/Python/2.7/site-packages/docutils/io.py", line 18, in <module>
from docutils.utils.error_reporting import locale_encoding, ErrorString, ErrorOutput
File "/Library/Python/2.7/site-packages/docutils/utils/error_reporting.py", line 47, in <module>
locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1]
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 511, in getdefaultlocale
return _parse_localename(localename)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 443, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/private/var/folders/hl/n7326xr91ls3z8c3s08_dv4r0000gn/T/pip_build_rafagomes/virtualenvwrapper/setup.py", line 7, in <module>
pbr=True,
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/dist.py", line 239, in __init__
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/dist.py", line 263, in fetch_build_eggs
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 564, in resolve
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 802, in best_match
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 814, in obtain
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/dist.py", line 313, in fetch_build_egg
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/command/easy_install.py", line 593, in easy_install
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/command/easy_install.py", line 623, in install_item
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/command/easy_install.py", line 809, in install_eggs
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/command/easy_install.py", line 1015, in build_and_install
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/command/easy_install.py", line 1000, in run_setup
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/sandbox.py", line 50, in run_setup
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/sandbox.py", line 100, in run
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/sandbox.py", line 52, in <lambda>
File "setup.py", line 22, in <module>
File "/var/folders/hl/n7326xr91ls3z8c3s08_dv4r0000gn/T/easy_install-fh8Xd1/pbr-0.5.23/pbr/util.py", line 259, in cfg_to_args
File "/var/folders/hl/n7326xr91ls3z8c3s08_dv4r0000gn/T/easy_install-fh8Xd1/pbr-0.5.23/pbr/util.py", line 480, in wrap_commands
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 772, in get_command_list
klass = self.get_command_class(cmd)
File "build/bdist.macosx-10.9-x86_64/egg/setuptools/dist.py", line 366, in get_command_class
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 815, in get_command_class
__import__ (module_name)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/check.py", line 13, in <module>
from docutils.utils import Reporter
File "/Library/Python/2.7/site-packages/docutils/utils/__init__.py", line 20, in <module>
from docutils.io import FileOutput
File "/Library/Python/2.7/site-packages/docutils/io.py", line 18, in <module>
from docutils.utils.error_reporting import locale_encoding, ErrorString, ErrorOutput
File "/Library/Python/2.7/site-packages/docutils/utils/error_reporting.py", line 47, in <module>
locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1]
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 511, in getdefaultlocale
return _parse_localename(localename)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 443, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /private/var/folders/hl/n7326xr91ls3z8c3s08_dv4r0000gn/T/pip_build_rafagomes/virtualenvwrapper
Storing complete log in /Users/user/.pip/pip.log
Can anyone help me? Nothing on Google works
Thanks

It seem you need to fix your "local" variables in your .bashrc or .profile file.
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
More information here.

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

How do I solve error "dotenv installation error" on pycharm

I am trying to install dotenv package on pycharm edu,but keep getting error that reads "AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader' "
I tried to solve this using the python terminal by running command "pip install --user dotenv" as root user but still got the same error
command output reads as follows
Collecting dotenv
Using cached https://files.pythonhosted.org/packages/e2/46/3754073706e31670eed18bfa8a879305b56a471db15f20523c2427b10078/dotenv-0.0.5.tar.gz
Complete output from command python setup.py egg_info:
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 194, in setup_context
__import__('setuptools')
File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/__init__.py", line 2, in <module>
File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/extension.py", line 5, in <module>
File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/dist.py", line 7, in <module>
File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/command/__init__.py", line 8, in <module>
File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/command/install_scripts.py", line 3, in <module>
File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/pkg_resources.py", line 1518, in <module>
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pycharm-packaging11/dotenv/setup.py", line 23, in <module>
scripts=['scripts/dotenv']
File "/usr/lib/python3.6/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 269, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 313, in fetch_build_eggs
replace_conflicting=True,
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 826, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1092, in best_match
return self.obtain(req, installer)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1104, in obtain
return installer(requirement)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 380, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 663, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 693, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 873, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1101, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1087, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 233, in run_setup
with setup_context(setup_dir):
File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
return next(self.gen)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python3.6/contextlib.py", line 99, 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/pkg_resources/_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 194, in setup_context
__import__('setuptools')
File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/__init__.py", line 2, in <module>
File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/extension.py", line 5, in <module>
File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/dist.py", line 7, in <module>
File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/command/__init__.py", line 8, in <module>
File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/command/install_scripts.py", line 3, in <module>
File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/pkg_resources.py", line 1518, in <module>
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pycharm-packaging11/dotenv/"
Try installing "python-dotenv" package instead of "dotenv". This should solve the problem.
sudo pip install python-dotenv
Install python-dotenv and then import dotenv package instead of python-dotenv, because the latter doesn`t work

Problems importing magic on Windows 64-bit

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'

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 ?

cryptography AssertionError: sorry, but this version only supports 100 named groups

I'm installing several python packages via pip install on travis,
language: python
python:
- '2.7'
install:
- pip install -r requirements/env.txt
Everything worked fine, but today I started getting following error:
Running setup.py install for cryptography
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-hKwMR3/cryptography/setup.py", line 334, in <module>
**keywords_with_side_effects(sys.argv)
File "/opt/python/2.7.9/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/setuptools/dist.py", line 269, in __init__
_Distribution.__init__(self,attrs)
File "/opt/python/2.7.9/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/setuptools/dist.py", line 325, in finalize_options
ep.load()(self, ep.name, value)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/cffi/setuptools_ext.py", line 181, in cffi_modules
add_cffi_module(dist, cffi_module)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/cffi/setuptools_ext.py", line 48, in add_cffi_module
execfile(build_file_name, mod_vars)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/cffi/setuptools_ext.py", line 24, in execfile
exec(code, glob, glob)
File "src/_cffi_src/build_openssl.py", line 81, in <module>
extra_link_args=extra_link_args(compiler_type()),
File "/tmp/pip-build-hKwMR3/cryptography/src/_cffi_src/utils.py", line 61, in build_ffi_for_binding
extra_link_args=extra_link_args,
File "/tmp/pip-build-hKwMR3/cryptography/src/_cffi_src/utils.py", line 70, in build_ffi
ffi.cdef(cdef_source)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/cffi/api.py", line 105, in cdef
self._cdef(csource, override=override, packed=packed)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/cffi/api.py", line 119, in _cdef
self._parser.parse(csource, override=override, **options)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/cffi/cparser.py", line 299, in parse
self._internal_parse(csource)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/cffi/cparser.py", line 304, in _internal_parse
ast, macros, csource = self._parse(csource)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/cffi/cparser.py", line 260, in _parse
ast = _get_parser().parse(csource)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/cffi/cparser.py", line 40, in _get_parser
_parser_cache = pycparser.CParser()
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/pycparser/c_parser.py", line 87, in __init__
outputdir=taboutputdir)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/pycparser/c_lexer.py", line 66, in build
self.lexer = lex.lex(object=self, **kwargs)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/pycparser/ply/lex.py", line 911, in lex
lexobj.readtab(lextab, ldict)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/pycparser/ply/lex.py", line 233, in readtab
titem.append((re.compile(pat, lextab._lexreflags | re.VERBOSE), _names_to_funcs(func_name, fdict)))
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/re.py", line 194, in compile
return _compile(pattern, flags)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/re.py", line 249, in _compile
p = sre_compile.compile(pattern, flags)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/sre_compile.py", line 583, in compile
"sorry, but this version only supports 100 named groups"
AssertionError: sorry, but this version only supports 100 named groups
Solutions?
There is a bug with PyCParser - See https://github.com/pyca/cryptography/issues/3187
The work around is to use another version or to not use the binary distribution.
pip install git+https://github.com/eliben/pycparser#release_v2.14
or
pip install --no-binary pycparser

Categories

Resources