how to install python libraries in linux? - python

While I was installing Python libraries on Linux, it threw the below error. How can I fix it?
I ran the below command to install:
python setup.py install
Output:
running install
running build
running build_ext
error: pyconfig.h: No such file or directory

The first thing to try is to install the appropriate module via your package manager. Each distro has many, many, many Python modules already packaged and ready to go.
If you insist on installing a module from source then you'll need the development package for your distro's Python. This is usually called python-devel, python-dev, or something similar. Use the package manager to install it.

Related

in virtualenv, pip installing locally from source fails

I am trying to install a library in a virtualenv instance with pip. The library version I want (wxPython 3.0.2)
is not available on PyPi; it is only available for download from SourceForge. Thus, I have the source tarball downloaded on my machine and I am trying to install it in such a way that it will play nicely with virtualenv.
(I am on a Windows computer, running Python 2.7.)
I have tried the following:
doing a direct install: pip install wxPython-src-3.0.2.0.tar.bz2
extracting the files from the tarball to wxPython-src-3.0.2.0, then installing from the extracted directory: pip install wxPython-src-3.0.2.0
extracting the files from the tarball, then navigating into the extracted folder to the nested wxPython directory, which holds the setup.py file, and then installing from there: pip install wxPython
The last attempt seems the most promising, but I get the following traceback:
Processing \wxpython-src-3.0.2.0\wxpython
Complete output from command python setup.py egg_info:
Setuptools must be installed to build an egg
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\__MY_USERNAME__\appdata\local\temp\pip-req-build-q0pxlt\
This is also strange, because it suggests I don't have setuptools even though I can run pip list and see version 40.6.3 installed.
Any help appreciated.
Why not install a precompiled version? There are a lot of .exe files at SF. You probably need wxPython3.0-win64-3.0.2.0-py27.exe.
Also take a look at Christoph Gohlke's collection.
If you still insist on installing from sources please bear in mind that wxPython 3 is so old it predates pip. Forget about pip.
First, you need to install wxWidgets as wxPython is just a Python wrapper for wxWidgets C++ library. Extract wxPython-src-3.0.2.0.tar.bz2 and follow instructions in wxPython-src-3.0.2.0/docs/msw/install.txt.
After compiling and installing wxWidgets compile wxPython. See wxPython-src-3.0.2.0/wxPython/docs/BUILD.txt.
My eventual solution was the easy way out: installing my package (wxPython) locally as #phd suggested, and opting for local package access via either virtualenv --system-site-packages env or deleting the "no-global-site-packages.txt" file in an existing environment folder.
Not what I expected to do, but it works so no complaints.

Install Python module paramiko on windows

I have been trying to install paramiko module on windows without success. I have been getting errors related to Visual C++ compiler missing. Is it possible to install paramiko without having to go through compile process.
Based on the method from this question this is what I would suggest (assuming you already have >=python-2.7.9 installed, if not, upgrade, 2.7.9 comes with pip, pre 2.7.9 doesn't):
Get the appropriate pycrypto whl file (based on python version and win32/win_amd64). I've found some available here (can't vouch for the site as I don't use python on windows much).
Run pip install pycrypto-stuff.whl (in a command prompt window in the directory where you've saved the pycrypto whl file).
Run pip install paramiko (in a command prompt, but can be in w/e folder you like).
That should do the trick. In general a simple pip install package_name would work, but pycrypto does not provide a wheel file (binary package), therefore you have to build it. By the sound of it you don't have Visual C++ installed (or not the right version, it only works for one, I don't recall which), pycrypto needs an extension package built to use the system crypto libraries, which is why the source package isn't working.
I was able to get it working by installing the following packages using pip.
pip install bcrypt cryptography pynacl paramiko
These were the packages my Linux install used as prerequisites, so they should work on windows as well.

Windows installer for Python module which includes dependencies

I have a python module with an entry point in its setup.py which points to __ main__.py. I want to be able to distribute this module to my coworkers in such a way that they can install it using a windows installer, and execute the entry point from the command line. They already have Python installed on their computer.
The built-in python setup.py bdist_wininst functionality looked perfect, except that my module has a third party module dependency, and for some reason, bdist_wininst does not install dependencies even if they are specified in the setup's install_requires.
All-in-one windows exe solutions such as py2exe or pyinstaller are not suitable since the entry point requires input, and I want the user to be able to specify the input via the command line.
Of course, I could distribute the module source files and have my coworkers run python setup.py install, but they will be too afraid - they are not programmers.
Yes, it would be possible to use an application like Nullsoft NSIS to build an installer that would install your python package, but it will require more code and an extra build step.
Do your coworkers have pip and setuptools installed? Are you able to distribute your package on pypi? If so, it would be really simple for your coworkers to just do pip install mypackage. It has the added benefit of handling dependencies and if you use python wheels, your users don't require a build environment to install your package.

How to prevent setuptools install package as an .egg

For example, installing IPython on Linux (where setuptools is not installed) I've got IPython installed in site-packages\IPython.
Installing IPython on Windows (where IPython requires setuptools), after executing the same command
python setup.py install
I get IPython installed in site-packages\ipython-0.13.2-py2.7.egg\IPython
Is there a way to install the module "old way" i.e. into site-packages\IPython?
I've discovered that
python setup.py install --old-and-unmanageable
does the job, but I am not sure it is a good way as --old-and-unmanageable is marked "Try not to use this!".
I don't know if it's applicable in your case, but the --root option also does this. For example, the Fedora packaging guidelines make use of this, since the versioning is managed externally by RPM. https://fedoraproject.org/wiki/Packaging:Python_Eggs

installing python libraries

Ok, so i've downloaded the following library:
http://www.lag.net/paramiko/
and i can't seem to figure out how to install on my local machine:
Mac OS X 10.4.11
To use the package that you got from the web-site: "python setup.py install
"
My advice is to use easy_install instead of downloading packages straight from the project web-site.
To do this, you must first install setuptools.
Then just use the command "easy_install paramiko".
As you use lots of different packages, this ends up saving you lots of hassle.

Categories

Resources