Pretty new to linux/suse and python so excuse me if I cause some simple questions.
I've search through stackoverflow and haven't gotten a result for my question.
I'm running on Windows with a Virtual machine using SUSE. I'm trying to install py.test, but to install it, it needs either pip or easy_install. I've heard pip is preferred over easy_install, so I tried installing that with get-pip.py.
I run it with
python get-pip.py
and it tells me it has been installed, this is what it ouputs
Collecting pip
Using cached pip-6.1.1-py2.py3-none-any.whl
Collecting setuptools
Using cached setuptools-15.1-py2.py3-none-any.whl
Installing collected packages: pip, setuptools
Successfully installed pip-6.1.1 setuptools-15.1
I tried running
pip install -U pytest
however the command pip has not been found. I also looked into python-pip package via openSUSE, though I'm not sure how to open a .ymp file through a VM.
Would I have to add a path for it to work? Pointers would be appreciated.
It looks like pip was unstalled by a regular user, so it was installed under the user's homedir, thus needs to be explicitly added to the path.
On openSUSE I'd suggest installing it using YaST (as root) and it'll end up in /usr/bin/pip, shareable by all users. Here's how it looks like on openSUSE 13.2:
$> which pip
/usr/bin/pip
$> rpm -qf /usr/bin/pip
python3-pip-1.5.6-2.1.3.noarch
Just search for pip in the software management tool.
Also many additional python packages/modules come prepackaged as openSUSE RPMs, better check the software management tool 1st.
Related
I recently had issues with my local Anaconda version and decided to reinstall it.
I chose the newest version (Anaconda 5.0.1 (Python 3.6)) and started to reinstall all my packages.
There's a problem installing pyimzml package.
To install it, I've tried:
pip install pyimzml
and
pip install git+git://github.com/alexandrovteam/pyimzML.git
Pip always gets stuck during Using cached wheezy.template-0.1.167.tar.gz.
Tried to install wheezy.template as source tarball from PyPI with pip, then it stucks at Processing c:\users\kawu\downloads\wheezy.template-0.1.167.tar.gz.
What can I do?
I solved the problem with the following steps (Windows 10 x64 machine):
Download wheezy.template tarball
Extract it and remove the nthreads=2 within the setup.py code.
Install wheezy.template with the python .\setup.py install command.
Install pyimzml
I tried many ways to install wheezy.template in my machine, like pip by network, pip/easy_install from local file, but the way above was the only way working out. I can not explain why but it works.
Is it possible to install a Python wheel without using pip? I always have issues with installing with pip, so I usually install libraries manually by copying and pasting. I'm wondering if there is a way to do wheel files in a similar manner.
I'm assuming you have internet access, but you don't have a working pip installation.
Download the pip wheel:
wget https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
To find the url of a release in the first place, you can get the index json endpoint. For example:
$ curl -s https://pypi.org/pypi/pip/json | jq ".urls[0].url"
"https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl"
For users not scripting this but just doing once-off, you may prefer to simply download a pip wheel using your browser. In that case, look for the latest release files here: https://pypi.org/project/pip/#files
Now you have a wheel for pip, and some other wheel file you want to install. You can actually "execute" the pip wheel file to install the other wheel file. For example, if you were trying to install setuptools v39.0.1 from bdist, the command would look like this:
$ python pip-10.0.1-py2.py3-none-any.whl/pip install --no-index setuptools-39.0.1-py2.py3-none-any.whl
Processing ./setuptools-39.0.1-py2.py3-none-any.whl
Installing collected packages: setuptools
Successfully installed setuptools-39.0.1
You will now have a working setuptools installation, even with no pip installation.
In case you were wondering, yes you can use the same trick to install pip itself. That command would look like this:
python pip-10.0.1-py2.py3-none-any.whl/pip install --no-index pip-10.0.1-py2.py3-none-any.whl
And now you should have a working pip installation, associated with whichever interpreter this python executable is pointing at.
It is. Actually .whl files are just zip archives, so you can just extract their content and play with libraries path variable to make it work.
Yet it is really bad practice.
I have python 3.3 working and can run some basic code (like print("Hello World")). Next I need so get PyOpenSSL set up. I've downloaded and unzipped the pyOpenSSL-master.zip from their github site, but I have no idea what to do with it next.
I moved the unzipped directory into /libs, cd into /libs/pyopenssl-master and did python setup.py install --user. But that failed with
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory
Other than the directory not existing, which I assume that the installer would create, the bigger problem is that it appears to be trying to write to the python 2.7 folder and I'm using 3.3.
If you can't tell, I'm pretty much out of my element. I've never installed a Python library before and I'm also not great with OSX installations. Can anyone help me get this set up? Thanks.
Here's how you can install pyOpenSSL on OS X (or just about any other platform):
Install pip
Install it using a package for your operating system. For example, if you use brew, brew install pip.
If there is no package for your operating system, download https://raw.github.com/pypa/pip/master/contrib/get-pip.py
Run it (probably as root, unfortunately): sudo python get-pip.py
Install virtualenv using pip - pip install --user virtualenv
Create a virtualenv to install pyOpenSSL into - virtualenv ~/Environments/pyOpenSSL-stuff
Activate the virtualenv - . ~/Environments/pyOpenSSL-stuff/bin/activate
Install pyOpenSSL with pip - pip install pyopenssl
At this point you have pyOpenSSL installed in a virtualenv. Any time you want to use pyOpenSSL you'll need to activate the virtualenv. I suggest that you actually create a virtualenv for each project of yours that you work on and install all of the necessary dependencies for each project into that project's virtualenv.
This does result in a lot of duplicate installations of packages. Unfortunately this seems to be the state of the art for Python package installation. Fortunately most Python packages are rather small.
I was looking for a tutorial on how to install Python libraries in the wheel format.
It does not seem straightforward so I'd appreciate a simple step by step tutorial how to install the module named "requests" for CPython.
I downloaded it from: https://pypi.python.org/pypi/requests and now I have a .whl file. I've got Python 2.7 and 3.3 on Windows, so how do I install it so all the other Python scripts I run can use it?
You want to install a downloaded wheel (.whl) file on Python under Windows?
Install pip on your Python(s) on Windows (on Python 3.4+ it is already included)
Upgrade pip if necessary (on the command line)
pip install -U pip
Install a local wheel file using pip (on the command line)
pip install --no-index --find-links=LocalPathToWheelFile PackageName
Option --no-index tells pip to not look on pypi.python.org (which would fail for many packages if you have no compiler installed), --find-links then tells pip where to look for instead. PackageName is the name of the package (numpy, scipy, .. first part or whole of wheel file name). For more informations see the install options of pip.
You can execute these commands in the command prompt when switching to your Scripts folder of your Python installation.
Example:
cd C:\Python27\Scripts
pip install -U pip
pip install --no-index --find-links=LocalPathToWheelFile PackageName
Note: It can still be that the package does not install on Windows because it may contain C/C++ source files which need to be compiled. You would need then to make sure a compiler is installed. Often searching for alternative pre-compiled distributions is the fastest way out.
For example numpy-1.9.2+mkl-cp27-none-win_amd64.whl has PackageName numpy.
If you want to be relax for installing libraries for python.
You should using pip, that is python installer package.
To install pip:
Download ez_setup.py and then run:
python ez_setup.py
Then download get-pip.py and run:
python get-pip.py
upgrade installed setuptools by pip:
pip install setuptools --upgrade
If you got this error:
Wheel installs require setuptools >= 0.8 for dist-info support.
pip's wheel support requires setuptools >= 0.8 for dist-info support.
Add --no-use-wheel to above cmd:
pip install setuptools --no-use-wheel --upgrade
Now, you can install libraries for python, just by:
pip install library_name
For example:
pip install requests
Note that to install some library may they need to compile, so you need to have compiler.
On windows there is a site for Unofficial Windows Binaries for Python Extension Packages that have huge python packages and complied python packages for windows.
For example to install pip using this site, just download and install setuptools and pip installer from that.
To install wheel packages in python 2.7x:
Install python 2.7x (i would recommend python 2.78) - download the appropriate python binary for your version of windows . You can download python 2.78 at this site https://www.python.org/download/releases/2.7.8/
-I would recommend installing the graphical Tk module, and including python 2.78 in the windows path (environment variables) during installation.
Install get-pip.py and setuptools
Download the installer at
https://bootstrap.pypa.io/get-pip.py
Double click the above file to run it. It will install pip and setuptools [or update them, if you have an earlier version of either]
-Double click the above file and wait - it will open a black window and print will scroll across the screen as it downloads and installs [or updates] pip and setuptools --->when it finishes the window will close.
Open an elevated command prompt - click on windows start icon, enter cmd in the search field (but do not press enter), then press ctrl+shift+. Click 'yes' when the uac box appears.
A-type
cd c:\python27\scripts
[or cd \scripts ]
B-type
pip install -u
Eg to install pyside, type pip install -u pyside
Wait - it will state 'downloading PySide or -->it will download and install the appropriate version of the python package [the one that corresponds to your version of python and windows.]
Note - if you have downloaded the .whl file and saved it locally on your hard drive, type in
pip install --no-index --find-links=localpathtowheelfile packagename
**to install a previously downloaded wheel package you need to type in the following command
pip install --no-index --find-links=localpathtowheelfile packagename
Have you checked this http://docs.python.org/2/install/ ?
First you have to install the module
$ pip install requests
Then, before using it you must import it from your program.
from requests import requests
Note that your modules must be in the same directory.
Then you can use it.
For this part you have to check for the documentation.
Install distribute by downloading and running distribute_setup.py. This will make easy_install available, and from there you can install pip with easy_install pip. Then you can run pip install CAGE. Using pip to install things is a lot easier than messing with manually running setup.py, because pip can do things like:
automatically resolve dependencies
show you a list of all installed packages and their versions
install a set of specified packages from a requirements.txt
upgrade and uninstall packages
work with virtualenv
If you're on Windows, the one downside of pip occurs when there are C library dependencies, as pip will want a C toolchain installed so it can compile things. If that is the case, then there are two options. If there are precompiled binaries on PyPI, then just run easy_install package instead; easy_install knows how to use binary packages. You can also check Christoph Gohlke's site for executable installers of many binary packages. These can also be installed by easy_install if you want to use them with a virtualenv (just point it to the path of the .exe) or you can click and run if you don't care about virtualenv.
The main point is that no matter what route you choose to install packages, at no point are you ever moving around files by hand. You need to get out of the mindset of "I extracted this archive, where do I put these .py files?" That's not how it works. You're either running pip, running easy_install, running setup.py, clicking on an installer package, or using your distribution's installer. At no point are you ever doing anything by hand with the files directly.
Once you have a library downloaded you can execute this from the MS-DOS command box:
python setup.py install
The setup.py is located inside every library main folder.
For windows, there are automatic installer packages available at this site
It includes most of the python packages.
But the best way for it is of course using pip.
You don't need to download exclusively from the website. Just make sure you have pip (which you probably will if you have python installed). Just open your Command Prompt (CMD) and run the command:
pip install pygame
It will automatically download the correct whl version of pygame compatible with your configuration of PC. Make sure you remember the version which appears while "downloading" as this is the compatible version of .whl packages you shall be looking for in the future.
Simple steps to install python in Ubuntu:
Download Python
$ cd /usr/src
$ wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
Extract the downloaded package
$ sudo tar xzf Python-3.6.0.tgz
Compile Python source
$ cd Python-3.6.0
$ sudo ./configure
$ sudo make altinstall
Note make altinstall is used to prevent replacing the default python binary file /usr/bin/python.
check the python version
# python3.6 -V
i have write the answer here
How to add/use libraries in Python (3.5.1)
but no problem will rewrite it again
if u have or you can create a file requirements.txt which contains the libraries that you want to install for ex:
numpy==1.14.2
Pillow==5.1.0
You gonna situate in your folder which contains that requirements.txt in my case the path to my project is
C:\Users\LE\Desktop\Projet2_Sig_Exo3\exo 3\k-means
now just type
python -m pip install -r ./requirements.txt
and all the libararies that you want gonna install
C:\Users\LE\Desktop\Projet2_Sig_Exo3\exo 3\k-means>python -m pip install -r ./requirements.txt
I'm trying to install Django package in a virtualenv. I'm on a new computer (OSX 10.8.2). I installed virtualenv via easy_install. With the virtualenv activated, I ran:
(pyenv)$ pip install Django
Downloading/unpacking Django
Downloading Django-1.5.1.tar.gz (8.0MB): 2.0MB downloaded
Hash of the package https://pypi.python.org/packages/source/D/Django/Django-1.5.1.tar.gz#md5=7465f6383264ba167a9a031d6b058bff (from https://pypi.python.org/simple/Django/) (<md5 HASH object # 0x108453df0>) doesn't match the expected hash 7465f6383264ba167a9a031d6b058bff!
Bad md5 hash for package https://pypi.python.org/packages/source/D/Django/Django-1.5.1.tar.gz#md5=7465f6383264ba167a9a031d6b058bff (from https://pypi.python.org/simple/Django/)
This happens even if I delete virtualenv and start over. I've tried again repeatedly over the past few hours, it always happens. Any suggestions?
I have the same problem when I try sudo pip install Pillow, and I try sudo pip install --no-cache-dir Pillow, it works for me.
If it's just this package that you can't get to install, you could download the tarball manually, and then use pip to install it from that file. The Django download site has checksums that you can validate manually as well. I don't use osx, but probably something like this would help:
cd /tmp
wget https://pypi.python.org/packages/source/D/Django/Django-1.5.1.tar.gz
md5sum Django-1.5.1.tar.gz
pip install Django-1.5.1.tar.gz
For me below command works
pip install django --no-cache-dir
I now had this issue several times.
Like others mentioned before me, pip install [module] --no-cache-dir
helps most of the time.
But sometimes, you got some dependencies to install first and it fails installing one of these (md5 validation failed).
Just had this problem myself. In this case, installing this dependency alone like pip install dependency
worked and after that I was able to install the first module.
Also pip install -vvv is nice for more info gathering on general problem solving