how to force buildout to use already installed package - python

On a server, for disk optimization, we do not install a C compiler,
and here is the problem :
I want to install 'spur' python package with buildout 2.3.1,
spur is using pycrypto which requires a C compiler.
To avoid compilation, I installed on the server (Suse 11SP2) the rpm python-pycrypto (python-pycrypto-2.6-31.7.x86_64.rpm). I can check with 'pip freeze' that pycrypto is installed :
pip freeze
lxml==2.1.2
mod-python==3.3.1
Numeric==24.2
numpy==1.3.0
pycrypto==2.6
pywbem==0.7.0
PyXML==0.8.4
Nevertheless, when I start buildout, it still tries to build pycrypto with a C compiler that does not exist.
So I added include-site-packages = true and allowed-eggs-from-site-packages = pycrypto in buildout.cfg, but they are not taken in account.
I also tried to do a :
python bootstrap.py --allow-site-packages
bin/buildout
but that did not help too.
What can I do to avoid buildout compile a package that is already compiled and installed from rpm ?
Here is the buildout.cfg
[buildout]
newest = false
extensions = gp.vcsdevelop
develop-dir = src
parts = eggs tests wsgi
include-site-packages = true
allowed-eggs-from-site-packages = pycrypto
eggs =
Django==1.4.8
ordereddict
ipython==0.13.2
django-webtest
django-grappelli<2.5.0
django-bootstrap3-datetimepicker
z3c.recipe.usercrontab
rrdgraphs
south
achilterm
pynag
pyaml<14
DjangoDevKit==1.0.3
Sphinx
xlwt
xlrd
spur
...
and the logs :
# bin/buildout
Unused options for buildout: 'allowed-eggs-from-site-packages' 'include-site-packages'.
Installing eggs.
Getting distribution for 'pycrypto!=2.4,>=2.1'.
configure: error: in `/tmp/easy_install-QFXca_/pycrypto-2.6.1':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 2254, in main
File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 380, in run
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 610, in easy_install
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 659, in install_item
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 842, in install_eggs
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1070, in build_and_install
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1056, in run_setup
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 240, in run_setup
File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__
self.gen.throw(type, value, traceback)
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 193, in setup_context
File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__
self.gen.throw(type, value, traceback)
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 164, in save_modules
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 139, in resume
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 152, in save_modules
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 193, in setup_context
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 237, in run_setup
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 267, in run
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 236, in runner
File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 46, in _execfile
File "/tmp/easy_install-QFXca_/pycrypto-2.6.1/setup.py", line 456, in <module>
File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py", line 160, in run
File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py", line 146, in call_command
File "/usr/lib64/python2.6/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "build/bdist.linux-x86_64/egg/setuptools/command/install_lib.py", line 10, in run
File "/usr/lib64/python2.6/distutils/command/install_lib.py", line 112, in build
self.run_command('build_ext')
File "/usr/lib64/python2.6/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/tmp/easy_install-QFXca_/pycrypto-2.6.1/setup.py", line 251, in run
File "/usr/lib64/python2.6/distutils/cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/tmp/easy_install-QFXca_/pycrypto-2.6.1/setup.py", line 278, in run
RuntimeError: autoconf error
An error occurred when trying to install pycrypto 2.6.1. Look above this message for any errors that were output by easy_install.
While:
Installing eggs.
Getting distribution for 'pycrypto!=2.4,>=2.1'.
Error: Couldn't install: pycrypto 2.6.1

I found a workaround :
I just created a egg-link file into develop-eggs dir :
$ cat develop-eggs/pycrypto.egg-link
/usr/lib64/python2.6/site-packages

I got no evidence that zc.buildout > 1.7.1 supports include-site-packages, nor allowed-eggs-from-site-packages.
On my local machine I searched for the mentioned features in the following versions of zc.buildout:
zc.buildout-1.4.4-py2.7.egg
zc.buildout-1.6.3-py2.7.egg
zc.buildout-1.7.1-py2.7.egg
zc.buildout-2.0.0-py2.7.egg
zc.buildout-2.0.1-py2.7.egg
zc.buildout-2.1.0-py2.7.egg
zc.buildout-2.2.0-py2.7.egg
zc.buildout-2.2.1-py2.7.egg
zc.buildout-2.2.3-py2.7.egg
zc.buildout-2.2.4-py2.7.egg
zc.buildout-2.2.5-py2.7.egg
zc.buildout-2.3.0-py2.7.egg
zc.buildout-2.3.1-py2.7.egg
Check Readme on https://pypi.python.org/pypi/zc.buildout/1.7.1. The features were introduced somewhere around zc.buildout 1.5.0. The last release, which supports those features is 1.7.1.
They made some kind of relaunch with zc.buildout 2.0.0...
Quote from the changlog, version 2.0.0:
This is a backward incompatible release of buildout that attempts to correct mistakes made in buildout 1.
Buildout no-longer tries to provide full or partial isolation from system Python installations. If you want isolation, use buildout with virtualenv, or use a clean build of Python to begin with.
In your case this means, if you want to use those features you need to use zc.buildout 1.7.1.
It's also important, that it's not possible to use both options at the same time. Use allowed-eggs-from-site-packages (only specific packages), or include-site-packages.
I assume you're using the boostrap.py version 1: http://downloads.buildout.org/1/bootstrap.py
This version does not support the ´--allow-site-packages´ options, since it was intended to use with zc.buildout 1.x, which handles this case (or at least 1.5.x).
Well, after this short trip in buildout history, I guess the following two points will solve your problem:
Be sure you're using boostrap.py 2: https://bootstrap.pypa.io/bootstrap-buildout.py. Only this version supports the --allow-site-packages option.
Make sure you are using a suitable zc.buildout version for yout boostrap.py verson.
Then python bootstrap.py --allow-site-packages works as expected.

Related

python cmake chooses wrong Windows SDK version

I try to compile the Frechet-CUDA package for python. I installed C++ via Visual Studio and installed dlib and cmake for python to compile the package. Still get the following error:
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19043.
CMake Error at C:/Users/Anwender/AppData/Local/Programs/Python/Python37/Lib/site-packages/cmake/data/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Boost (missing: Boost_INCLUDE_DIR system chrono
program_options python3 numpy3) (Required is at least version "1.63")
Call Stack (most recent call first):
C:/Users/Anwender/AppData/Local/Programs/Python/Python37/Lib/site-packages/cmake/data/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Users/Anwender/AppData/Local/Programs/Python/Python37/Lib/site-packages/cmake/data/share/cmake-3.24/Modules/FindBoost.cmake:2376 (find_package_handle_standard_args)
CMakeLists.txt:23 (find_package)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Anwender/Documents/GitHub/Artjom_bachelor_thesis/py/build/temp.win-amd64-cpython-37/Release/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Anwender/Documents/GitHub/Artjom_bachelor_thesis/py/build/temp.win-amd64-cpython-37/Release/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "setup.py", line 81, in <module>
zip_safe=False,
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\_distutils\core.py", line 185, in setup
return run_commands(dist)
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\_distutils\core.py", line 201, in run_commands
dist.run_commands()
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\_distutils\dist.py", line 973, in run_commands
self.run_command(cmd)
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\_distutils\dist.py", line 992, in run_command
cmd_obj.run()
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\command\install.py", line 74, in run
self.do_egg_install()
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\command\install.py", line 123, in do_egg_install
self.run_command('bdist_egg')
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\_distutils\cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\_distutils\dist.py", line 992, in run_command
cmd_obj.run()
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\command\bdist_egg.py", line 165, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\command\bdist_egg.py", line 151, in call_command
self.run_command(cmdname)
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\_distutils\cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\_distutils\dist.py", line 992, in run_command
cmd_obj.run()
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\command\install_lib.py", line 11, in run
self.build()
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\_distutils\command\install_lib.py", line 112, in build
self.run_command('build_ext')
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\_distutils\cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "C:\Users\Anwender\AppData\Local\Programs\Spyder\pkgs\setuptools\_distutils\dist.py", line 992, in run_command
cmd_obj.run()
File "setup.py", line 35, in run
self.build_extension(ext)
File "setup.py", line 64, in build_extension
cwd=self.build_temp, env=env)
File "C:\Users\Anwender\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 328, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Anwender\\Documents\\GitHub\\Artjom_bachelor_thesis\\py/..', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Anwender\\Documents\\GitHub\\Artjom_bachelor_thesis\\py\\build\\lib.win-amd64-cpython-37', '-DPYTHON_EXECUTABLE=C:\\Users\\Anwender\\AppData\\Local\\Programs\\Python\\Python37\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Anwender\\Documents\\GitHub\\Artjom_bachelor_thesis\\py\\build\\lib.win-amd64-cpython-37', '-A', 'x64']' returned non-zero exit status 1.
My best guess is that CMake is unable to choose the correct SDK version. I tried this solution to enforce a specific SDK version which I certainly installed on my device. Sadly the file mentioned in the solution does not contain the paragraph for a default SDK version. I tried to insert the mentioned paragraph but the process still fails with the exact same error.
Feel free to ask for more information about programme versions or my device!
My sys spec is the following:
System : Win 10
Python-ver: 3.7
Latest SDK version:
Microsoft.WindowsAppRuntime.1.1_1004.584.2120.0_x64__8wekyb3d8bbwe
Microsoft.WindowsAppRuntime.1.1_1004.584.2120.0_x86__8wekyb3d8bbwe
EDIT I : The CMakeOutput.log file contains only the following line :
The system is: Windows - 10.0.19043 - AMD64
EDIT II : I have Microsoft Visual Studio Community 2022 (64-Bit) - Current
Version 17.3.3 installed on my machine.
My C++ version :
Visual C++ 2022 00482-90000-00000-AA994
EDIT III : This is not a CUDA problem. The CUDA toolset is not needed to install the package.
EDIT IV : I've updated the SDK version as mentioned by #Tsyvarev. Still the compilation error persists.

Difficulty installing Gensim using from source and pip

I am trying to install Gensim which I downloaded from this site. The installation using pip is also not working for me. I am getting the error below.
C:\Users\Anirudh\Downloads\gensim-0.10.3>python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to gensim.egg-info\requires.txt
writing gensim.egg-info\PKG-INFO
writing top-level names to gensim.egg-info\top_level.txt
writing dependency_links to gensim.egg-info\dependency_links.txt
reading manifest file 'gensim.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.sh' under directory '.'
no previously-included directories found matching 'docs\src*'
writing manifest file 'gensim.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
building 'gensim.models.word2vec_inner' extension
Unable to find vcvarsall.bat
an integer is required
Traceback (most recent call last):
File "setup.py", line 166, in <module>
include_package_data=True,
File "C:\Python27\lib\distutils\core.py", line 151, in setup
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\distribute-0.6.49-py2.7.egg\setuptools\com
mand\install.py", line 73, in run
self.do_egg_install()
File "C:\Python27\lib\site-packages\distribute-0.6.49-py2.7.egg\setuptools\com
mand\install.py", line 93, in do_egg_install
self.run_command('bdist_egg')
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\distribute-0.6.49-py2.7.egg\setuptools\com
mand\bdist_egg.py", line 179, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "C:\Python27\lib\site-packages\distribute-0.6.49-py2.7.egg\setuptools\com
mand\bdist_egg.py", line 166, in call_command
self.run_command(cmdname)
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\distribute-0.6.49-py2.7.egg\setuptools\com
mand\install_lib.py", line 20, in run
self.build()
File "C:\Python27\lib\distutils\command\install_lib.py", line 111, in build
self.run_command('build_ext')
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "setup.py", line 71, in run
"There was an issue with your platform configuration - see above.")
TypeError: an integer is required
I have seen the same question in stackoverflow. I also did what was mentioned in this question. I have installed Microsoft c++ compiler for python 2.7. Is there any windows binary for Gensim? How can I install it.
download VCForPython27,find the file :'C:/Users/Forward(ur username)/AppData/Local/Programs/Common/Microsoft/Visual C++ for Python/9.0/vcvarsall.bat'
find this file msvc9compiler.py in c:/python27(ur dir)/Lib/distutils,get this function and change the function as follows,directly point to this file!
def find_vcvarsall(version):
"""Find the vcvarsall.bat file
At first it tries to find the productdir of VS 2008 in the registry. If
that fails it falls back to the VS90COMNTOOLS env var.
"""
vcvarsall = 'C:/Users/Forward(ur username)/AppData/Local/Programs/Common/Microsoft/Visual C++ for Python/9.0/vcvarsall.bat'
if os.path.isfile(vcvarsall):
return vcvarsall
log.debug("Unable to find vcvarsall.bat")
return None
In my opinion the easiest way to get gensim configured on my windows machine was to download portable python from here then open up command prompt to the directory of PortablePython/App/Scripts and then easy_install.exe gensim

TypeError: dist must be a Distribution instance

My package depends on BeautifulSoup. If I install my package in a fresh virtualenv via python setup.py develop, I get the following error. If I execute python setup.py develop a second time, everything seems to work fine. I have no idea, what's happening. How to fix it to get a reproducable setup?
Best match: beautifulsoup4 4.3.2
Downloading https://pypi.python.org/packages/source/b/beautifulsoup4/beautifulsoup4-4.3.2.tar.gz#md5=b8d157a204d56512a4cc196e53e7d8ee
Processing beautifulsoup4-4.3.2.tar.gz
Writing /tmp/easy_install-1eBfi3/beautifulsoup4-4.3.2/setup.cfg
Running beautifulsoup4-4.3.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-1eBfi3/beautifulsoup4-4.3.2/egg-dist-tmp-YmoFSq
Traceback (most recent call last):
File "setup.py", line 73, in <module>
""",
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/develop.py", line 27, in run
self.install_for_development()
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/develop.py", line 129, in install_for_development
self.process_distribution(None, self.dist, not self.no_deps)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 671, in process_distribution
[requirement], self.local_index, self.easy_install
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/pkg_resources.py", line 564, in resolve
dist = best[req.key] = env.best_match(req, self, installer)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/pkg_resources.py", line 802, in best_match
return self.obtain(req, installer) # try and download/install
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/pkg_resources.py", line 814, in obtain
return installer(requirement)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 593, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 623, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 809, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1015, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1000, in run_setup
run_setup(setup_script, args)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 50, in run_setup
lambda: execfile(
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 100, in run
return func()
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 52, in <lambda>
{'__file__':setup_script, '__name__':'__main__'}
File "setup.py", line 27, in <module>
'raven',
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 970, in run_command
cmd_obj = self.get_command_obj(command)
File "/usr/lib/python2.7/distutils/dist.py", line 846, in get_command_obj
cmd_obj = self.command_obj[command] = klass(self)
File "/home/domma/VirtualEnvs/orcid/local/lib/python2.7/site-packages/setuptools/__init__.py", line 69, in __init__
_Command.__init__(self,dist)
File "/usr/lib/python2.7/distutils/cmd.py", line 59, in __init__
raise TypeError, "dist must be a Distribution instance"
TypeError: dist must be a Distribution instance
This error has to do with a discrepancy between the versions of distutils and setuptools installed on your machine. Upgrading setuptools to the current version is likely to resolve the issue.
EDIT: This solution no longer works for me (and apparently never worked for Jens -- see comment below). What now works for me is to import setuptools before anything else in whatever script I'm calling that leads to this error.
This error is discussed in many issues on GitHub, in many packages, but I find this discussion to be the most informative.
The only way I was able to solve it was to follow the https://bugs.python.org/file37554/distutils_accomodate_distribution_ducktypes.patch
So - I removed /usr/lib/python2.7/distutils/cmd.py and /usr/lib/python2.7/distutils/cmd.pyc ( ran a python setup.py develop - just to make sure it fails and is not using the pyc from somewhere else ) and then recreated /usr/lib/python2.7/distutils/cmd.py - only this time with the changes as shown in the patch. Then when I used python setup.py again - it worked..
install dnspython. pip install dnspython. Or check if u have older version of dnspython and upgrade
Try using pip for installing your package
$ pip install -e path/to/your/Project
See http://pip.readthedocs.org/en/latest/reference/pip_install.html#editable-installs for more information.
When I encountered this, it appeared at first glance that it was complaining that Distribution() didn't produce a Distribution instance, but that was only partly true.
setuptools provides its own Distribution, and monkeypatches it into distutils. That works in most cases, but will fail if you get a reference to Distribution before setuptools has been imported and done its magic.
The top of the script read:
from distutils.dist import Distribution
and then later we were importing and using various parts of setuptools.
The solution in my case was to do a late import in the function that uses it so Distribution was obtained after setuptools was loaded.

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.

Problem using easy_install on Windows 7, 64 bit. (cannot find python.exe)

I have just now installed Python 2.6 on my Windows 7 (64 bit) Lenovo t61p laptop.
I have downloaded Sphinx and nose and apparently installed them correctly using
python setup.py install
(at least no errors were reported during the installation).
Now I am trying to install pymongo using easy_install but I am not having much success. It seems that easy_install isn't working at all. I execute easy_install as administrator:
C:\>easy_install
Cannot find Python executable C:\Program Files\Python26\python.exe
The path C:\Program Files\Python26\python.exe is correct.
I have found this bug report on bugs.python.org which seems to be related, although its status is 'Resolved'.
Do you have any ideas as to what may be wrong? Any pointers, hints or tips for diagnosing the problem further would be greatly appreciated.
EDIT: This is the stacktrace I receive when trying to install pymongo:
C:\Users\Rune Ibsen\Documents\Downloads\pymongo-1.4>python setup.py install
running install
running bdist_egg
running egg_info
writing pymongo.egg-info\PKG-INFO
writing top-level names to pymongo.egg-info\top_level.txt
writing dependency_links to pymongo.egg-info\dependency_links.txt
reading manifest file 'pymongo.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pymongo.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
building 'pymongo._cbson' extension
Traceback (most recent call last):
File "setup.py", line 166, in <module>
"doc": doc})
File "C:\Program Files\Python26\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Program Files\Python26\lib\distutils\dist.py", line 975, in run_commands
self.run_command(cmd)
File "C:\Program Files\Python26\lib\distutils\dist.py", line 995, in run_command
cmd_obj.run()
File "C:\Program Files\Python26\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\command\install.py", line 76, in run
File "C:\Program Files\Python26\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\command\install.py", line 96, in do_egg_install
File "C:\Program Files\Python26\lib\distutils\cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Python26\lib\distutils\dist.py", line 995, in run_command
cmd_obj.run()
File "C:\Program Files\Python26\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\command\bdist_egg.py", line 174, in run
File "C:\Program Files\Python26\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\command\bdist_egg.py", line 161, in call_command
File "C:\Program Files\Python26\lib\distutils\cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Python26\lib\distutils\dist.py", line 995, in run_command
cmd_obj.run()
File "C:\Program Files\Python26\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\command\install_lib.py", line 20, in run
File "C:\Program Files\Python26\lib\distutils\command\install_lib.py", line 113, in build
self.run_command('build_ext')
File "C:\Program Files\Python26\lib\distutils\cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Python26\lib\distutils\dist.py", line 995, in run_command
cmd_obj.run()
File "setup.py", line 107, in run
build_ext.run(self)
File "C:\Program Files\Python26\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "C:\Program Files\Python26\lib\distutils\command\build_ext.py", line 449, in build_extensions
self.build_extension(ext)
File "setup.py", line 117, in build_extension
build_ext.build_extension(self, ext)
File "C:\Program Files\Python26\lib\distutils\command\build_ext.py", line 499, in build_extension
depends=ext.depends)
File "C:\Program Files\Python26\lib\distutils\msvc9compiler.py", line 448, in compile
self.initialize()
File "C:\Program Files\Python26\lib\distutils\msvc9compiler.py", line 358, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Program Files\Python26\lib\distutils\msvc9compiler.py", line 274, in query_vcvarsall
raise ValueError(str(list(result.keys())))
ValueError: [u'path']
C:\Users\Rune Ibsen\Documents\Downloads\pymongo-1.4>
PS.: I previously installed Python 3.1 but later installed 2.6 because I am not sure whether pymongo supports 3.1.
PPS.: I have tried installing pymongo using the python setup.py install approach, but this resulted in a nasty-looking stack trace, so I thought I would try to let easy_install take care of it for me.
PPPS.: I am completely new to Python, easy_install, eggs etc.
I don't know anything about these specific packages so I may not be much help. But for what it's worth I have run into the "can't find python executable" errors before with 64 bit python. It happened when the package I was trying to install didn't have a 64 bit version and it was looking for 32 bit python. I ended up just installing and using the 32 bit python. That may not be the issue here, but I figured I'd through it out there.
can't help much with easy_install - but python setup.py install should work w/ pymongo. what was the stack trace?
Install this 64-bit version of setuptools instead.
http://www.lfd.uci.edu/~gohlke/pythonlibs/#setuptools

Categories