Virtual Environment not working on windows - Django - python

After installing Virtual Environment and activating it (Scripts\activate), I ran pip freeze to show global installed modules. When I try to install any of the packages, it says they are already installed.
I tried installing virtual environment using --no-site-packages, but it didn't help either. It still shows all globally installed packages.
I installed virtualenvwrapper, but it didn't help either.
If I remove C:\Python27\Lib\site-packages from PYTHONPATH and run pip freeze, it does not show any global packages, and it does not install any packages either. There is no response, it just freezes on "Downloading package".

Related

How to uninstall Python packages installed globally on Mac?

While writing Python code in PyCharm on Mac I installed some Python Packages not in the virtual Environment but globally. How can I check those installed Packages and delete them?
To check whether a package is installed, run
pip freeze
to get a list of all packages, then search for the package.
To uninstall a package, run
pip uninstall [package name]
Of course you have to run these commands globally (and not inside your virtual environment)
I wish you much luck 🍀
You can use pip freeze command to get all your globally installed packages and delete them

pip installing package in weird location

I'm trying to install imgui with pip with anaconda3 All of my packages are in anaconda3\Lib\site-packages but when I install imgui, it installs it in another folder on C:\Python39
Which location should I keep imgui in?
If you are installing with pip, it seems like you are installing the package from the main python installation, instead of using the virtual environment. Be sure to have your virtual environment selected when launching the command. You could usually check that if at the beginning of the line in your terminal you have the name of the virtual environment between brackets, like (anaconda3) C:\Users\...

Pip won't install packages in virtualenv

After performing a system upgrade this morning, I'm not able to install or update packages in any of my old or fresh created virtual environments.
I create the virtual environments using virtualenvwrapper.
I've tried rebooting my PC, recreating all of my virtual environments, but nothing worked.
Strange enough, pip freeze does not output my installed packages, although they are found in sitepackages.
Im using python3.7 on manjaro linux with the newest kernel.
In my envs and on my system pip 19.2.3 is installed.
The error I'm seeing is the following:
pip install <package>
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
When trying to use the system pip without virtualenv, everything works just fine.
pip install cython
Requirement already satisfied: cython in /home/manuel/.local/lib/python3.7/site-packages (0.29.13
I expect pip to install the desired package to the sitepackages folder of my virtualenv without telling me to not use a '--user' install, which I'm not doing explicitly anyway
I was able to fix this myself.
I checked all the pip config files here https://pip.pypa.io/en/latest/user_guide/#configuration
Seems like in the pip configuration file /etc/pip.conf the user parameter was set to true.
Changing it to false resolved my issue.
I still don't know why/if the config file changed.

Conda Virtual Environment Packages

Lately I've been using conda instead of virtualenv and I think I like it better, except when I install packages I don't think they are only installed into my virtual environment.
If I run pip freeze within my virtual environment I get the list of packages installed, no surprise there. However, when I deactivate the virtual environment and run pip freeze again, I get the same list. Is my environment not separated from my base distro? Plus, how do I create a clean environment if my packages are shared across all environments?
Note: I noticed this after installing packages with pip using pip setup.py install within a package. However, according to the docs you can use pip in a conda virtual environment.

Installing a package in Python virtualenv still causes it to be installed globally

I installed virtualenv and created a virtual environment called ENV1.
Then I activated the environment by running 'source bin/activate'. I am sure the virtual environment is activated because the command prompt has changed, reflecting the new environment.
Then from that command prompt, I ran 'pip install lpthw.web'. I would have thought this package will get installed somewhere in the ENV1 directory, but instead it got installed in /usr/local/lib/python2.6/dist-packages/
Is this the correct behavior? Could someone please point out if I am doing something wrong.
Check which pip you are actually running (which pip), also try running pip -E path-to-your-env install ....

Categories

Resources