Why does a virtualenv environment contain argparse, distribute and wsgiref? [duplicate] - python

This question already has answers here:
Why does pip freeze report some packages in a fresh virtualenv created with --no-site-packages?
(2 answers)
Closed 9 years ago.
I am using virtualenv version 1.7.1.2 with python 2.7.3 to create virtual python ennvironments. But when I create such an environment and activate it, I can see the following packages are installed (using pip freeze):
argparse==1.2.1
distribute==0.6.24
wsgiref==0.1.2
Why is that? What does that mean?

These are the standard packages, and will always follow with that version of Python and Virtualenv.
distribute is pretty self-explainatory. It's necessary for pip. Distribute also contains setuptools, but inside the package so not recognized with pip freeze. For more information about what it actually does check out your env/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg.
wsgiref is actually a part of the standard library, but isn't recognized as so. There's a bug report on it, and it's fixed in Python 3.3+. Read more about it in Why does pip freeze report some packages in a fresh virtualenv created with --no-site-packages?
I can't find out why argparse is there though, but my guess is because it's a dependency or something like wsgiref. Finding package dependencies in Python can be a bit hacky/painful though, especially if it's already installed in your virtualenv.

Related

How to see what packages are required to install another package? [duplicate]

This question already has answers here:
List dependencies of Python wheel file
(7 answers)
Closed 3 years ago.
I want to install many packages on an offline computer, I download and install manually using the following code:
pip install XXXXX.whl --user
Although the code above does the offline installation, the package needs other packages so it tries to connect to the internet. I can see what package it is looking for. So, I will download manually and again install that. If there are a lot of packages required, it becomes overwhelming.
Any better solution? Can I know from the beginning that what packages have to be downloaded for installing my package?
Do you use anaconda?
Make a conda environment on your online pc and install all your packages you need.
Then check with
'''
conda list
'''
What packages you need.

Why pip is required or what is the use of it in Python? [duplicate]

This question already has answers here:
What is pip in Python? [duplicate]
(3 answers)
Closed 4 years ago.
I am little confused. Newbie into Python, apologies if I am asking silly ones. What is the need of pip if we can run a file using python filename?
What is the difference between python setup.py install and pip install package_name if both are used for installing packages? Which is good?
From wikipedia:
pip is a recursive acronym that can stand for either "Pip Installs Packages" or "Pip Installs Python"
As you are newbie, you may not even know why you would need a "package manager".
Python is shipped with some basic built-in modules like the math module for extra maths operators and the re module for executing regular expressions. These are pre-included as they are considered quite useful and will be used quite a lot. However, more obscure or larger modules such as numpy (C based arrays) and others are not included - this is where pip comes in.
You can use the "package manager" to install, uninstall, update etc. any package within PyPI which is the Python Package Index. The result of this is that Python remains small, but there are immediately millions of free packages available for use if desired.
pip is a recommended tool for installing Python packages. For example, if you need to install an external package/library, say requests, you have to install it first using pip.
pip install requests
In your current scenario, you may not have to use external libraries. However, you may need it in future.
According to Wikipedia
pip is a package management system used to install and manage software packages written in Python. Many packages can be found in the default source for packages and their dependencies — Python Package Index (PyPI).
Python 2.7.9 and later (on the python2 series), and Python 3.4 and later include pip (pip3 for Python 3) by default.pip is a recursive acronym that can stand for either "Pip Installs Packages" or "Pip Installs Python". Alternatively, pip stands for "preferred installer program".

Install pip on a fresh compiled python [duplicate]

This question already has answers here:
How to install pip with Python 3?
(23 answers)
Closed 5 years ago.
I have just downloaded the python 3.4 source from the web site and compiled it with ./configure and make. I get a fully functional python.
Everyone says that pip comes embedded with python but that is not true if I compile it from source.
On a console I do:
./python -m pip install numpy
from the compilation folder, and I get:
No module named pip
I am on a RHEL7 system and I want to produce a standalone python folder with all the needed modules. My intention is to ship this python folder along with some python software so that I am sure that everything is ok. (Not to rely on others installing all the packages that are needed on a fresh RHEL7 installation)
Instead of pip try pip3. It is python version 3.x and appropriate one for it is pip3 I guess.

Install a python package in a virtual environment directly from git [duplicate]

This question already has answers here:
pip install from git repo branch
(8 answers)
Closed 5 years ago.
I have a python package I want to use, but it appears that the version installed through pip is seriously outdated, to the point where example code doesn't work. some research independently verified that in order to get the code to work properly, I need the latest version from git.
How do I install a python package from within a virtual environment directly from git without going through pip?
Alternatively, since I don't know too much about pip, if this should never be necessary, then how do I force pip to install the latest version on github?
You'll want to reference this documentation.
Here's the basic format:
pip install -e vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir
In the case of git it'd be something like
pip install -e git+https://www.github.com/name_your_project/name_your_repo

virtualenv : installed packages are not avaliable outisde the environment [duplicate]

This question already has answers here:
Modules between multiple versions of Python Linux
(2 answers)
Closed 8 years ago.
I have 2 versions of python 2.7 and 3.3. I installed virtualenv hoping that I can work using two different python version.
I created my first project environment:
/usr/local/bin/virtualenv -p /usr/local/bin/python2.7 first
and installed pymysql package which is available to that environment only.
Now I want the same package to be available globally - how can I do that?
When I run pip install without setting the environment it actually installs in 3.3 version site packages which eventually fails as it is compatible for 2.7?
To have packages available globally you must install them globally. virtualenv is made specifically for making separate package installations. It doesn't provide anything else so I have no idea why are you using it.
You don't need to use virtualenv to have two Python version installed. In fact, virtualenv doesn't help with that at all. Virtualenv is to install several installs of the same Python version.
So to have two different versions of Python installed you simply just install two different versions of Python. It's that simple.
http://regebro.wordpress.com/2011/02/02/newbie-hint-on-installing-python-and-its-modules-and-packages/

Categories