Problems with virtualenv and pandas - pandas

I created a virtual env and that was where I installed the pandas and numpy libraries, at the end of the installation I closed the virtual env and realized that it was also installed globally on the computer and I don't understand why this happens
to be installed only in the virtual environment and not global
Is there a way to install it only in the environment or will it always be installed globally?

Related

Python 3.9.6 virtual environment: different packages shown in two different machines

I am a bit confused about the python Virtual environment. I thought you use them so you can make sure that the same packages and setting can run in two different machines. Here's my problem. I have installed and activate a python VENV in a Virtual machine running Centos 7. I have created a git repository that contains a django app called CTR and a python VENV:
CTR python39-RIGS-venv README.md
when activated:
source python39-RIGS-venv/bin/activate
pip3 list
Package Version
------------------ ---------
asgiref 3.4.1
certifi 2021.10.8
charset-normalizer 2.0.7
Django 3.2.9
idna 3.3
pip 21.3.1
pytz 2021.3
requests 2.26.0
setuptools 56.0.0
sqlparse 0.4.2
urllib3 1.26.7
I have then downloaded the same repo in my mac, activated the python VENV and this is the result:
source python39-RIGS-venv/bin/activate
pip3 list
Package Version
---------- -------
pip 21.1.3
setuptools 56.0.0
Why not all packages installed are visible in the mac VENV? I thought that was the purpose of python VENV. Make sure you can run same configuration in different machine. What am I missing here? Thank you for your help
After a more accurate search I have found out the question has been already answered here:
How to use python virtual environment in another computer
I will leave the link here to help other people with my same dilemma.

No module named 'bs4' in Virtual Env

I'm working in Python 3.4 When I run my Python file in the virtual env, it gives an ImportError: No module named 'bs4' even though I installed the module in the virtual env. Any help will be appreciated.
Did you try using pip install beautifulsoup4 in your virtual env? The package's name on pip is beautofulsoup4, not bs4.

Running tensorflow in ipython

tensorflow works using python in a virtualenv I created, but tensorflow doesn't work in the same virtualenv with ipython. This is the error I get:
Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name mock was given, but was not able to be found.
I have tried installing ipython within the virtual environment. This is the message I get:
Requirement already satisfied: ipython in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
If I try to uninstall ipython within the virtual environment. I get this message:
Not uninstalling ipython at /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Any ideas on how to get this to work? I don't know how to force the install of ipython to be inside the virtual environment. I've tried deleting the virtual environment and making a new one from scratch, but I get the same error.
I think I figured out the problem. pip was pointing to /Library/Frameworks/Python.framework/Versions/3.4/bin/pip
My ipython was pointing to /opt/local/bin/ipython
I re-installed tensorflow within my virtual environment by calling /opt/local/bin/pip-2.7 install --upgrade tensorflow
Now I can use tensorflow within ipython.

ImportError: Missing required dependencies ['numpy'] from Pandas Created Conda Environment

I created a new conda environment as follows
conda create -n NAME python=3.5
Added edit, of course activate the environment like so
activate NAME
Installed these libraries all at once
conda install numpy scipy pandas scikit-learn jupyter matplotlib
relevant libary versions that conda installed
when importing pandas ge
ImportError: Missing required dependencies ['numpy']
Can anyone replicate this installation of env on windows? I am thinking one of the files version are causing this and cannot find a solution, barring an externality.
Have uninstalled and installed pandas, numpy, etc all libraries, have also tried installing with pip even, nothing is working. Have even created another environment from scratch same error is occurring.
Conda should have installed a number of libraries when you build python 3.5 in the new environment. If you run "conda list" in the command line of the newly built environment it will show the packages you have by default. Try to build the environment with "conda create -n py35 python=3.5 anaconda" so it uses the anaconda python and will auto install packages.

What python virtual environment install locally and system-wise?

When Python virtual environment venv is activated, I wonder what installation will be added to the local venv and what go to the OS as system-wise?
I ask after notice that my LAMP installation, while venv is activated, has the system-wise effect i.e. NOT within the environment as I thought.