Getting "weak reference" error in cryptography-0.8.2 python install - python

On our linux redhat RHEL 6 cluster, I downloaded cryptography-0.8.2.tar.gz and then ran
python setup.py install --user
in the cryptography-0.8.2 directory. I am getting the following error. Can anyone help me solve it? I'm not up to speed on weak references, just trying to install the cryptography module. Thanks much!
rcook#rzgpu2 (cryptography-0.8.2 ): python setup.py install --user
running install
Traceback (most recent call last):
File "setup.py", line 342, in <module>
**keywords_with_side_effects(sys.argv)
File "/usr/apps/python/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/apps/python/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/apps/python/lib/python2.7/distutils/dist.py", line 971, in run_command
cmd_obj.ensure_finalized()
File "/usr/apps/python/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "setup.py", line 119, in finalize_options
self.distribution.ext_modules = get_ext_modules()
File "setup.py", line 78, in get_ext_modules
from cryptography.hazmat.bindings.commoncrypto.binding import (
File "src/cryptography/hazmat/bindings/commoncrypto/binding.py", line 14, in <module>
class Binding(object):
File "src/cryptography/hazmat/bindings/commoncrypto/binding.py", line 36, in Binding
"-framework", "Security", "-framework", "CoreFoundation"
File "src/cryptography/hazmat/bindings/utils.py", line 97, in build_ffi_for_binding
extra_link_args=extra_link_args,
File "src/cryptography/hazmat/bindings/utils.py", line 106, in build_ffi
ffi.cdef(cdef_source)
File "/g/g0/rcook/.local/lib/python2.7/site-packages/cffi/api.py", line 106, in cdef
self._parser.parse(csource, override=override, packed=packed)
File "/g/g0/rcook/.local/lib/python2.7/site-packages/cffi/cparser.py", line 165, in parse
self._internal_parse(csource)
File "/g/g0/rcook/.local/lib/python2.7/site-packages/cffi/cparser.py", line 199, in _internal_parse
realtype = self._get_type(decl.type, name=decl.name)
File "/g/g0/rcook/.local/lib/python2.7/site-packages/cffi/cparser.py", line 360, in _get_type
return self._get_struct_union_enum_type('struct', type, name)
File "/g/g0/rcook/.local/lib/python2.7/site-packages/cffi/cparser.py", line 434, in _get_struct_union_enum_type
return self._structnode2type[type]
File "/usr/apps/python/lib/python2.7/weakref.py", line 256, in __getitem__
return self.data[ref(key)]
TypeError: cannot create weak reference to 'Struct' object

The problem is actually in the pycparser module.
As per https://bugs.launchpad.net/openstack-gate/+bug/1446882 do the following:
pip uninstall pycparser && pip install -Iv pycparser==2.10

As it turns out pycparser-2.11 is the culprit for this error message/bug.
pip uninstall pycparser && pip install -Iv pycparser==2.10

Related

Can't pip install pandas... error from a subprocess

I am trying to install pandas to use in my python code. I was able to upgrade my pip using pip install upgrade pip but when I try to install pandas using pip install pandas I get the following errors:
Traceback (most recent call last):
File "C:\Users\Brian\AppData\Local\Temp\pip-install-i72pcle8\numpy_328f6081d36f426b90572be17f203722\numpy\distutils\fcompiler\compaq.py", line 78
, in CompaqVisualFCompiler
m.initialize()
File "C:\Users\Brian\AppData\Local\Temp\pip-install-i72pcle8\numpy_328f6081d36f426b90572be17f203722\numpy\distutils\msvccompiler.py", line 48, in
initialize
_MSVCCompiler.initialize(self)
File "C:\msys64\mingw64\lib\python3.9\distutils\msvccompiler.py", line 259, in initialize
self.__paths = self.get_msvc_paths("path")
File "C:\msys64\mingw64\lib\python3.9\distutils\msvccompiler.py", line 602, in get_msvc_paths
r"\Win32 (%s)\Directories" % (self.__root, platform))
AttributeError: 'MSVCCompiler' object has no attribute '_MSVCCompiler__root'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Brian\AppData\Local\Temp\tmp94oxoujq_in_process.py", line 363, in <module>
main()
File "C:\Users\Brian\AppData\Local\Temp\tmp94oxoujq_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\Brian\AppData\Local\Temp\tmp94oxoujq_in_process.py", line 164, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "C:\Users\Brian\AppData\Local\Temp\pip-build-env-tr54un10\overlay\lib\python3.9\site-packages\setuptools\build_meta.py", line 157, in prepare
e_metadata_for_build_wheel
self.run_setup()
File "C:\Users\Brian\AppData\Local\Temp\pip-build-env-tr54un10\overlay\lib\python3.9\site-packages\setuptools\build_meta.py", line 248, in run_se
tup
super(_BuildMetaLegacyBackend,
File "C:\Users\Brian\AppData\Local\Temp\pip-build-env-tr54un10\overlay\lib\python3.9\site-packages\setuptools\build_meta.py", line 142, in run_se
tup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 508, in <module>
setup_package()
File "setup.py", line 500, in setup_package
setup(**metadata)
File "C:\Users\Brian\AppData\Local\Temp\pip-install-i72pcle8\numpy_328f6081d36f426b90572be17f203722\numpy\distutils\core.py", line 169, in setup
return old_setup(**new_attr)
File "C:\Users\Brian\AppData\Local\Temp\pip-build-env-tr54un10\overlay\lib\python3.9\site-packages\setuptools\__init__.py", line 165, in setup
return distutils.core.setup(**attrs)
File "C:\msys64\mingw64\lib\python3.9\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\msys64\mingw64\lib\python3.9\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\msys64\mingw64\lib\python3.9\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Brian\AppData\Local\Temp\pip-build-env-tr54un10\overlay\lib\python3.9\site-packages\setuptools\command\dist_info.py", line 31, in
run
egg_info.run()
File "C:\Users\Brian\AppData\Local\Temp\pip-install-i72pcle8\numpy_328f6081d36f426b90572be17f203722\numpy\distutils\command\egg_info.py", line 24
, in run
self.run_command("build_src")
File "C:\msys64\mingw64\lib\python3.9\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\msys64\mingw64\lib\python3.9\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Brian\AppData\Local\Temp\pip-install-i72pcle8\numpy_328f6081d36f426b90572be17f203722\numpy\distutils\command\build_src.py", line 1
44, in run
self.build_sources()
File "C:\Users\Brian\AppData\Local\Temp\pip-install-i72pcle8\numpy_328f6081d36f426b90572be17f203722\numpy\distutils\command\build_src.py", line 1
55, in build_sources
self.build_library_sources(*libname_info)
File "C:\Users\Brian\AppData\Local\Temp\pip-install-i72pcle8\numpy_328f6081d36f426b90572be17f203722\numpy\distutils\command\build_src.py", line 2
88, in build_library_sources
sources = self.generate_sources(sources, (lib_name, build_info))
File "C:\Users\Brian\AppData\Local\Temp\pip-install-i72pcle8\numpy_328f6081d36f426b90572be17f203722\numpy\distutils\command\build_src.py", line 3
78, in generate_sources
source = func(extension, build_dir)
File "numpy\core\setup.py", line 658, in get_mathlib_info
st = config_cmd.try_link('int main(void) { return 0;}')
File "C:\msys64\mingw64\lib\python3.9\distutils\command\config.py", line 241, in
try_link
self._check_compiler()
File "C:\Users\Brian\AppData\Local\Temp\pip-install-i72pcle8\numpy_328f6081d36f426b90572be17f203722\numpy\distutils\command\config.py", line 80,
in _check_compiler
self.fcompiler = new_fcompiler(compiler=self.fcompiler,
File "C:\Users\Brian\AppData\Local\Temp\pip-install-i72pcle8\numpy_328f6081d36f426b90572be17f203722\numpy\distutils\fcompiler\__init__.py", line
876, in new_fcompiler
load_all_fcompiler_classes()
File "C:\Users\Brian\AppData\Local\Temp\pip-install-i72pcle8\numpy_328f6081d36f426b90572be17f203722\numpy\distutils\fcompiler\__init__.py", line
777, in load_all_fcompiler_classes
__import__ (module_name)
File "C:\Users\Brian\AppData\Local\Temp\pip-install-i72pcle8\numpy_328f6081d36f426b90572be17f203722\numpy\distutils\fcompiler\compaq.py", line 54
, in <module>
class CompaqVisualFCompiler(FCompiler):
File "C:\Users\Brian\AppData\Local\Temp\pip-install-i72pcle8\numpy_328f6081d36f426b90572be17f203722\numpy\distutils\fcompiler\compaq.py", line 83
, in CompaqVisualFCompiler
if '_MSVCCompiler__root' in str(msg):
NameError: name 'msg' is not defined
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
Encountered error while generating package metadata.
See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
[end of output]
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Before upgrading my pip, I tried installing pandas but none of the versions that I tried to install would download; however, I don't think I was getting these same errors before I upgraded pip. Can someone help me figure out how to install pandas? Is there a different way that I need to install it without using pip install pandas?
Remove the NumPy then try to install pandas again.
pip uninstall package_name

ImportError: No module named _markerlib when trying to install via pip

Did somebody experienced the same problem? I tried to run a solution from SO:
pip install --upgrade distribute
and
pip install --upgrade setuptools
And I got the same result, every time:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-JC9mq_/distribute/setup.py", line 58, in <module>
setuptools.setup(**setup_params)
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 972, in run_command
cmd_obj.run()
File "setuptools/command/egg_info.py", line 177, in run
writer = ep.load(installer=installer)
File "pkg_resources.py", line 2241, in load
if require: self.require(env, installer)
File "pkg_resources.py", line 2254, in require
working_set.resolve(self.dist.requires(self.extras),env,installer)))
File "pkg_resources.py", line 2471, in requires
dm = self._dep_map
File "pkg_resources.py", line 2682, in _dep_map
self.__dep_map = self._compute_dependencies()
File "pkg_resources.py", line 2699, in _compute_dependencies
from _markerlib import compile as compile_marker
ImportError: No module named _markerlib
python 2.7, pip 8.1.2
[EDIT]
The solution of creating a new env. with virtualenv myenv --distribute worked for the local environment, but when I try to push to the heroku, it gives me exactly the same error: No module named _markerlib. So, the problem is not just in the local env.
I fixed it this way, I think.
pip uninstall setuptools
download https://bitbucket.org/pypa/setuptools/raw/0.7.3/ez_setup.py
Run that,then
pip install %HOME%\Downloads\wheel-0.25.0.tar.gz
pip install Distribute
I did this so this would work
pip install django-validated-file

cannot import name ContextualZipFile when installing Cython

I downloaded Cython and run:
sudo python setup.py install
and I get the following error:
Unable to find pgen, not compiling formal grammar.
running install
Traceback (most recent call last):
File "setup.py", line 357, in <module>
**setup_args
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 972, in run_command
cmd_obj.run()
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/install.py", line 98, in do_egg_install
easy_install = self.distribution.get_command_class('easy_install')
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 388, in get_command_class
self.cmdclass[command] = cmdclass = ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2088, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 42, in <module>
from setuptools.archive_util import unpack_archive
File "/usr/local/lib/python2.7/dist-packages/setuptools/archive_util.py", line 15, in <module>
from pkg_resources import ensure_directory, ContextualZipFile
ImportError: cannot import name ContextualZipFile
I also get the same error when I install with pip install.

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

I am trying to install GDAL in virtual environment based on the various solutions out there.
However the download itself already fails:
$ pip install --no-install GDAL
Here is the pip.log
------------------------------------------------------------
/Users/test/venv/bin/pip run on Sun Jun 2 15:35:15 2013
Downloading/unpacking GDAL
Running setup.py egg_info for package GDAL
running egg_info
writing pip-egg-info/GDAL.egg-info/PKG-INFO
writing top-level names to pip-egg-info/GDAL.egg-info/top_level.txt
writing dependency_links to pip-egg-info/GDAL.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/Users/test/venv/build/GDAL/setup.py", line 267, in <module>
ext_modules = ext_modules )
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "<string>", line 14, in replacement_run
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/egg_info.py", line 259, in find_sources
mm.run()
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/egg_info.py", line 325, in run
self.add_defaults()
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/egg_info.py", line 361, in add_defaults
sdist.add_defaults(self)
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/sdist.py", line 211, in add_defaults
build_ext = self.get_finalized_command('build_ext')
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
cmd_obj.ensure_finalized()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/Users/test/venv/build/GDAL/setup.py", line 164, in finalize_options
self.gdaldir = self.get_gdal_config('prefix')
File "/Users/test/venv/build/GDAL/setup.py", line 144, in get_gdal_config
return fetch_config(option)
File "/Users/test/venv/build/GDAL/setup.py", line 97, in fetch_config
raise gdal_config_error, e""")
File "<string>", line 4, in <module>
__main__.gdal_config_error: [Errno 2] No such file or directory
Complete output from command python setup.py egg_info:
running egg_info
writing pip-egg-info/GDAL.egg-info/PKG-INFO
writing top-level names to pip-egg-info/GDAL.egg-info/top_level.txt
writing dependency_links to pip-egg-info/GDAL.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/Users/test/venv/build/GDAL/setup.py", line 267, in <module>
ext_modules = ext_modules )
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "<string>", line 14, in replacement_run
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/egg_info.py", line 259, in find_sources
mm.run()
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/egg_info.py", line 325, in run
self.add_defaults()
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/egg_info.py", line 361, in add_defaults
sdist.add_defaults(self)
File "/Users/test/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/command/sdist.py", line 211, in add_defaults
build_ext = self.get_finalized_command('build_ext')
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
cmd_obj.ensure_finalized()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/Users/test/venv/build/GDAL/setup.py", line 164, in finalize_options
self.gdaldir = self.get_gdal_config('prefix')
File "/Users/test/venv/build/GDAL/setup.py", line 144, in get_gdal_config
return fetch_config(option)
File "/Users/test/venv/build/GDAL/setup.py", line 97, in fetch_config
raise gdal_config_error, e""")
File "<string>", line 4, in <module>
__main__.gdal_config_error: [Errno 2] No such file or directory
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /Users/test/venv/build/GDAL
Exception information:
Traceback (most recent call last):
File "/Users/test/venv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/basecommand.py", line 139, in main
status = self.run(options, args)
File "/Users/test/venv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/commands/install.py", line 266, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/Users/test/venv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 1057, in prepare_files
req_to_install.run_egg_info()
File "/Users/test/venv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 236, in run_egg_info
command_desc='python setup.py egg_info')
File "/Users/test/venv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/util.py", line 662, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /Users/test/venv/build/GDAL
What am I missing?
The workaround given by #user1738154 didn't work as expected for me so went ahead and installed GDAL using HomeBrew then using pip into my Virtual environment.
$ brew install gdal
(venv)$ pip install GDAL
Everything compiled and ran like a charm.
A workaround to that problem is to
Download GDAL Complete from this site
Install GDAL Complete.pkg
Go to /Library/Frameworks/GDAL.framework/Versions/1.10/ and copy all files in there
Go to your virtual environment's sites-packages /venv/lib/python2.7/site-packages and paste the copied files in there
after install gdal using these steps on host:
sudo apt-get install gdal-bin
sudo apt-get install libgdal-dev
After that use
pip install GDAL==$(gdal-config --version) --global-option=build_ext --global-option="-I/usr/include/gdal"
This should work like charm

Unable to Install pycrypto

ValueError: invalid version number '2.20.51.20100613'
I'm having problems installing pycrypto. Tried package manager: pip & easy_install, didn't work. Tried to manually install it via "python setup.py install", the same error like the above appears.
I've followed the instructions here and got stuck at installing pycrypto after installing "mingW" gcc, g++ and msys-base (MSYS shell environment)
Not really sure what to do now after several days of trying.
Here's the complete output of the error:
C:\Users\Denz\Desktop>pip install pycrypto
Downloading/unpacking pycrypto
Running setup.py egg_info for package pycrypto
Installing collected packages: pycrypto
Running setup.py install for pycrypto
Traceback (most recent call last):
File "", line 1, in ?
File "C:\Users\Denz\Desktop\build\pycrypto\setup.py", line 340, in ?
core.setup(**kw)
File "C:\Python24\lib\distutils\core.py", line 149, in setup
dist.run_commands()
File "C:\Python24\lib\distutils\dist.py", line 946, in run_commands
self.run_command(cmd)
File "C:\Python24\lib\distutils\dist.py", line 966, in run_command
cmd_obj.run()
File "c:\python24\lib\site-packages\distribute-0.6.14-py2.4.egg\setuptools
\command\install.py", line 53, in run
return _install.run(self)
File "C:\Python24\lib\distutils\command\install.py", line 506, in run
self.run_command('build')
File "C:\Python24\lib\distutils\cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "C:\Python24\lib\distutils\dist.py", line 966, in run_command
cmd_obj.run()
File "C:\Python24\lib\distutils\command\build.py", line 112, in run
self.run_command(cmd_name)
File "C:\Python24\lib\distutils\cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "C:\Python24\lib\distutils\dist.py", line 966, in run_command
cmd_obj.run()
File "C:\Python24\lib\distutils\command\build_ext.py", line 253, in run
force=self.force)
File "C:\Python24\lib\distutils\ccompiler.py", line 1177, in new_compiler
return klass (None, dry_run, force)
File "C:\Python24\lib\distutils\cygwinccompiler.py", line 292, in init
CygwinCCompiler.__init__ (self, verbose, dry_run, force)
File "C:\Python24\lib\distutils\cygwinccompiler.py", line 83, in __init__
self.gcc_version, self.ld_version, self.dllwrap_version = \
File "C:\Python24\lib\distutils\cygwinccompiler.py", line 424, in get_versions
ld_version = StrictVersion(result.group(1))
File "C:\Python24\lib\distutils\version.py", line 40, in __init__
self.parse(vstring)
File "C:\Python24\lib\distutils\version.py", line 107, in parse
raise ValueError, "invalid version number '%s'" % vstring
ValueError: invalid version number '2.20.51.20100613'
You can get working windows binaries on this page.

Categories