I installed miniforge on my Mac M1 and created an environment.
conda create --name myenv
conda activate myenv
In this environment, I installed python and pip. There are some packages specifically available on pip, so I did a pip install -r requirements.txt, assuming that these packages would be dumped in the myenv environment.
However, when I do conda list, I am getting only pip as the installed package and pip list is giving me all the installed packages.
When I checked the path, my conda environment is in this path -
~/miniforge3/envs/myenv/bin/python
while my pip is in
/Users/I323017/Library/Python/3.8/lib/python/site-packages/pip
Could you please help me to create my pip env under the conda environment by default.
I was finally able to fix the issue.
When I do just pip install <package_name> within my environment, the package still gets installed in
/Users/I323017/Library/Python/3.8/lib/python/site-packages/pip
However, if I do python -m pip install <package_name> within my environment, the package will get installed under the environment directory.
Related
I am using conda as the Python3 package management tool, sometimes the conda repo did not contains some Python package. So I have to install it using pip, first I found the anaconda environment folder, the next step switch to the anaconda environment folder:
cd /usr/local/anaconda3/envs/pydolphin
then using this command to install package:
./bin/pip install musicbrainzngs
is there any short way to do this? is it possible to install it the PyCharm IDE the simple way? the PyCharm IDE using conda install by default.
First activate your conda environment:
conda activate <env>
This will switch to the version of pip installed in this environment. Then you can install using pip as per normal which will install it into your conda environment:
pip install musicbrainzngs
I'm currently trying to build a conda virtual environment for a project. However some packages are still not possible to install with the pip and conda commands (such as pyqt5 or liblsl for instance), but these are necessary for the project.
I tried to install these packages using the brew install command, while being in the virtual environment, but the packages do not appear in the conda virtual environment.
So, do you know if it is possible to install packages with the brew command and include it in the virtual environment ?
I'm working on a (python) project where the choice was to create a virtual environment using virtualenv. However, one of the project dependencies can't be installed through pip on macOS due to this bug: https://github.com/streamlit/streamlit/issues/283
The workaround is to conda install one of the dependencies to bypass the gcc compiler.
How do you conda install something in a virtual environment not created with conda?
I think the easiest approach would be to create a conda env by it's own.
1) Create a requirement.txt file by doing pip freeze > requirements.txt inside your virtualenv environment
2) Create conda env: conda create --name myenv
3) Activate your environment: source activate myenv
4) Install your dependencies: conda install --file requirements.txt
5) Install missing dependecy: conda install YOUR_MISSING_DEPENDENCY
In the accepted answer (upvoted) you can also change point 1) to use conda-installed packages (compatible with subsequent conda install, and excluding pip-installed packages that would be unavailable in conda channels, identified by "pypi" in their extended version names that only conda displays):
conda list --export | grep -v pypi > requirements.txt
And if you still want to use pip, the correct syntax that gets you packages versions list in a format compatible with pip install is now:
pip list --format=freeze > requirements.txt
I have installed the pygal package through the following command line:
conda install -c akode pygal
However, when I search this package in the Anaconda, I can only find this package in the base (root) environment. When I try to search this pygal package in my newly created environment, nothing can I find.
Why does this happen? and is there any solution to this problem?
When you are not in an environment and run conda install , it will install it in the base. If you activate your environment then install the package using conda install, it will apply to your environment.
source activate data_visualization_coursera
conda install -c akode pygal
Or you can install a specific package to an environment using this command
conda install -n <environment_name> <package_name>
You can find all of the documentation here https://conda.io/docs/user-guide/tasks/manage-environments.html
I have created one virtual-environment. Inside that I have to install few python packages. For that I need pip package inside virtual environment. How can I install pip inside virtual-environment?
According to the pip documentation, you can install pip in a virtual environment by typing the following command when your virtual environment is activated:
python -m ensurepip --upgrade
For your information, ensurepip is an in-built Python module that serves the purpose of installing pip in your Python environment.
you can also try with upgrading pip command even after no pip installed at you specified virtual location
python -m pip install --upgrade pip
This will give you an error as below but also install latest pip version on virtual location
Can't uninstall 'pip'. No files were found to uninstall.
Successfully installed pip-19.2.3
kindly try above option and let me in case any issue.
Usually, you install pip OUTSIDE of your virtual environment.
But after activating the virtualenv you just run "pip install" inside the environment.
Meaning, you install it outside the virtualenv.
You run "pip install" inside the virtualenv.
You can follow this useful guide:
http://docs.python-guide.org/en/latest/dev/virtualenvs/
When you create a virtual environment for a particular python revision installed in your computer, all the libraries currently installed in your python revision would be copied inside the virtual environment.
Pip is usually default available in your python revision directory.
If not, install it first in your original python install directory.
Then copy the pip.exe to the virtual environment's Scripts directory.
After that execute the below command from your terminal (this is for Windows):
\your_venv_directory_path\Scripts\pip.exe install --upgrade pip
Now you can just type
pip install --upgrade pip
and it should recognise the path to the pip.exe file inside your venv
when creating the virtual-environment, be sure to include pip in the command. e.g:
conda create -n my_env pip python=3.6.8
I would suggest deleting the venv and recreating it using the above command