Install Python module paramiko on windows - python

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.

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.

How do I install a Python library? [duplicate]

I'm having a hard time setting up python packages. EasyInstall from SetupTools is supposed to help that, but they don't have an executable for Python 2.6.
For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\site-packages according to INSTALL.txt, but runnning the tests does not work. Can someone help shed some light on this? Thanks!
The accepted answer is outdated. So first, pip is preferred over easy_install, (Why use pip over easy_install?). Then follow these steps to install pip on Windows, it's quite easy.
Install setuptools:
curl https://bootstrap.pypa.io/ez_setup.py | python
Install pip:
curl https://bootstrap.pypa.io/get-pip.py | python
Optionally, you can add the path to your environment so that you can use pip anywhere. It's somewhere like C:\Python33\Scripts.
Newer versions of Python for Windows come with the pip package manager. (source)
pip is already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4
Use that to install packages:
cd C:\Python\Scripts\
pip.exe install <package-name>
So in your case it'd be:
pip.exe install mechanize
This is a good tutorial on how to get easy_install on windows. The short answer: add C:\Python26\Scripts (or whatever python you have installed) to your PATH.
You don't need the executable for setuptools.
You can download the source code, unpack it, traverse to the downloaded directory and run python setup.py install in the command prompt
Starting with Python 2.7, pip is included by default. Simply download your desired package via
python -m pip install [package-name]
As I wrote elsewhere
Packaging in Python is dire. The root cause is that the language ships without a package manager.
Fortunately, there is one package manager for Python, called Pip. Pip is inspired by Ruby's Gem, but lacks some features. Ironically, Pip itself is complicated to install. Installation on the popular 64-bit Windows demands building and installing two packages from source. This is a big ask for anyone new to programming.
So the right thing to do is to install pip. However if you can't be bothered, Christoph Gohlke provides binaries for popular Python packages for all Windows platforms http://www.lfd.uci.edu/~gohlke/pythonlibs/
In fact, building some Python packages requires a C compiler (eg. mingw32) and library headers for the dependencies. This can be a nightmare on Windows, so remember the name Christoph Gohlke.
I had problems in installing packages on Windows. Found the solution. It works in Windows7+. Mainly anything with Windows Powershell should be able to make it work. This can help you get started with it.
Firstly, you'll need to add python installation to your PATH variable. This should help.
You need to download the package in zip format that you are trying to install and unzip it. If it is some odd zip format use 7Zip and it should be extracted.
Navigate to the directory extracted with setup.py using Windows Powershell (Use link for it if you have problems)
Run the command python setup.py install
That worked for me when nothing else was making any sense. I use Python 2.7 but the documentation suggests that same would work for Python 3.x also.
Upgrade the pip via command prompt ( Python Directory )
D:\Python 3.7.2>python -m pip install --upgrade pip
Now you can install the required Module
D:\Python 3.7.2>python -m pip install <<yourModuleName>>
pip is the package installer for python, update it first, then download what you need
python -m pip install --upgrade pip
Then:
python -m pip install <package_name>
You can also just download and run ez_setup.py, though the SetupTools documentation no longer suggests this. Worked fine for me as recently as 2 weeks ago.
PS D:\simcut> C:\Python27\Scripts\pip.exe install networkx
Collecting networkx
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:318: SNIMissingWarning: An HTTPS reques
t has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may caus
e the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer ve
rsion of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissi
ngwarning.
SNIMissingWarning
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SS
LContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL con
nections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.
readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading networkx-1.11-py2.py3-none-any.whl (1.3MB)
100% |################################| 1.3MB 664kB/s
Collecting decorator>=3.4.0 (from networkx)
Downloading decorator-4.0.11-py2.py3-none-any.whl
Installing collected packages: decorator, networkx
Successfully installed decorator-4.0.11 networkx-1.11
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SSLContext object i
s not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade
to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplat
formwarning.
InsecurePlatformWarning
Or just put the directory to your pip executable in your system path.
As mentioned by Blauhirn after 2.7 pip is preinstalled. If it is not working for you it might need to be added to path.
However if you run Windows 10 you no longer have to open a terminal to install a module. The same goes for opening Python as well.
You can type directly into the search menu pip install mechanize, select command and it will install:
If anything goes wrong however it may close before you can read the error but still it's a useful shortcut.

How to install lxml in Python 3.4 on Windows machine

I've been spending hours on this. I'm new to Python and can't see what the solution may be.
I have Python 3.4 and want to work with .docx, which requires lxml.
The workflow I've done so far is: I go to the Python lxml package installer page, but it's quite confusing to know which version I need. I tried with several of them that contained the 34 numbers, both .exe and .tar. I also tried pip install lxml3.4.4 and pip install lxml 3.4.4. None of them worked either.
This is what the command prompt says when I did pip install lxml (it automatically grabs the lxml 3.4.4 I've downloaded and then prints what you can see in the screenshot):
What am I doing wrong and what can I do to repair it? And/or what exact version of lxml do I need to install from where? I am really discouraged that this is so difficult. Thanks
As said at the lxml homepage, it happened to you:
If you fail to build lxml on your MS Windows system from the signed and tested sources that we release, consider using the binary builds from PyPI or the unofficial Windows binaries that Christoph Gohlke generously provides.
So you have to download the right wheel file from Unofficial Windows Binaries for Python Extension Packages.
Step 1: Download appropriate version
Depending on your machine you have to download the wheel file lxml‑3.4.4‑cp34‑none‑win32.whl or lxml‑3.4.4‑cp34‑none‑win_amd64.whl, because you want the version for Python3.4 (that's the 34 in cp34).
Step 2: Open cmd and navigate to the download folder
I have chosen to open the cmd in administrator mode. But this is probably not necessary for you.
Step 3: Install wheel file with pip
Now you have to install the unofficial wheel file with pip. Maybe you can do pip install pip --upgrade before you install the wheel file. But this is probably also not necessary for you. To do the installation, just type pip install <downloaded_file>.
Or as cgohlke mentioned in his comment to your question: If you can't do pip install in cmd directly, this is what you can try: C:\Python34\python.exe -m pip install <downloaded_file>. You have to edit the path if Python3.4 is installed elsewhere, of course.
Don't panic. If you try to install the wrong downloaded file (e. g. win32 instead of amd64), it shouldn't break anything. An error message should occur: <package name> is not a supported wheel on this platform.

Installing numpy for Python 2.7 while also having Python 3.4 installed?

I have both Python 2.7 and Python 3.4 (and have to have both because for the class I'm running, students have the option of using either). One student has used Python 2.7 and numpy for their project, but when I attempt to install numpy, it installs it to 3.4. I need to install it to 2.7.
I'm using numpy 1.9 from this site, which I'm told is also 2.7-specific: http://sourceforge.net/projects/numpy/files/NumPy/
However, nonetheless it still goes to the 3.4 folder. Copying it to Python 2.7 didn't work, obviously.
How do I do this?
I recommend installing with pip.
pip install numpy
If this doesn't work on windows then download the binary from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and convert it to a wheel before installing.
pip install wheel
wheel convert path/to/binary
pip install numpy_wheel
Pip is recommended because you can uninstall.
To check where you are installing to
pip -V
You may have an environmental variable path to the wrong pip.
Assuming that you are using, or at least you should use pip to install the library. You can specify the python version to be installed by changing the suffix, e.g. pip-2.7 install numpy.
pip install numpy
pip-2.7 install numpy
pip-3.4 install numpy
As an alternative, in case that you do not want to use pip is to download and install the library using setup with a similar technique.
python setup.py install
python2.7 setup.py install
python3.4 setup.py install
Your PATH isn't setup correctly.
C:> where pip
Should tell you which pip it is trying to use, and it is likely whichever one it found on your PATH first...
So, instead, you will want to run it as
C:> C:\mypython2install\pip.exe install numpy
Or, setup your path correctly. See here
Just one other note on issues like this. I had a similar problem with Python 2.7 libraries not being found, because I had miniconda installed for a Python virtual environment that was hijacking calls to python from other programs. After deleting the minconda directory in my home the problem went away and python libraries that were properly installed were found again.
Note-This answer is particularly for Windows PC which has both Python2 & Pyhton3 installed on it.
Both the versions of Python has their different directories somewhat like
"C:\Python27\" ----for python2
"C:\Python35\" ---- for python3
*(or it depends on what path you chose while installing Python**)*
pip GENERALLY exist under the directory "C:\Python**\Scripts"
there you can find exe files like:
pip.exe/pip2.exe/pip2.7.exe ----for python2
pip3.exe/pip3.5.exe ----for python3
to install packages on python2:
use
Python27\Scripts\pip2.exe install package_name
(where the 1st argument is the path of exe file, it might differ for your system)
to install packages on python3:
use
Python35\Scripts\pip3.exe install package_name
there is no need to uninstall any version of python to achieve the task.

Python3.3 can't find libpython3.3m.so in linux (pip-3.3)

I'm using ubuntu 12.10 with default python3.2. However I downloaded python 3.3 as its much more polished. Of course, since then I have a nightmare with installing modules for 3.3, as python3 packages from synaptic install to 3.2 dir. So, I installed pip using python 3.3. Now I have pip-3.3 command, great. But, when I tried "sudo pip-3.3 install PySide" I quickly got an error: "error: Failed to locate the Python library /usr/lib/libpython3.3m.so". What's more, when I run "sudo pip install PySide" (command for 2.7), it builded and installed and runs flawlessy. Pyvenv and virtualenv both fail too. But I wan't to do it non-env way,just install pyside to global 3.3 lib dir.
So how can I install that PySide to python 3.3? I just can't get it to work... It looks like I will have to stick with default ubuntu python 3 version (this one runs great, everything works both from pip and synaptic), but I like to use newest python as it gets better and better with every release.
Btw, if that matters I also got following warning before that error:
"package init file 'PySide/init.py' not found (or not a regular file)" and
"package init file 'pysideuic/init.py' not found (or not a regular file)"
Edit: I installed full python3.3 from synaptic, including pythoh3.3-dev, debug, lib etc. Everything.
And that dynamic python 3.3 lib exist in /usr/lib/x86_64-linux-gnu/libpython3.3m.so, maybe just python3.3 package for ubuntu is poor and installs it in wrong direction/doesn't do any symlinks tricks?
Please try this answer installing from source (PySide). Download pyside sources and install from source, follow the instructions on the link.

Categories

Resources