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
Related
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.
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 have a problem with the management of my environnements on Anaconda. I want to have three environnements, a "classic", another with ortools and a last with django. However, ortools can't be installed by using "conda install ortools", then i have to use pip. My problem is that when i use "pip install --user ortools" in the right environnement it install this package for all my environnements which have the same version of python than the right environnement. How could I fix this ?
Thanks !
#lucidbrot is correct in their comment. You should not use the --user argument in pip, because that will install into your $HOME directory, which every environment can access.
Here is a series of commands you can use to set up multiple environments, one with ortools
conda create --name ortools-env python=3
conda activate ortools-env
python -m pip install --no-cache-dir ortools
python -c "import ortools" # No error.
conda create --name django-env python=3 django
conda activate django-env
python -c "import ortools" # Error: module not found
For reference, the above code uses conda version 4.8.2
I am trying to figure out how to install packages for the first time. I have downloaded Python 2.7 with the Anaconda distribution. When I go to terminal and I type:
pip install pandas-datareader
I see a message that the package was installed successfully. However, when I enter:
import pandas-datareader as pdr
into Spyder, I get the error:
No module named pandas-datareader
I think this might be because I am not installing the package in the right directory. I also tried:
conda install -c anaconda pandas-datareader
and got the same result. I know there are many posts about installing packages, but I am looking for a super basic beginner explanation for how to troubleshoot this. What directory should I save packages in? How do I navigate to that directory? How do I use terminal to download the package into that directory, etc.
Conda installs any package to a conda environment and pip installs python packages to any environment. Your best bet is to create an environment and conda install to that. For example,
conda create -n py35
activate py35
conda install package_name
Typing these into the command line will set up your environment, activate it, and install whatever package you want.
After following your link, I got it to work by entering
!pip install pandas-datareader
in the Spyder Ipython console!
... since I am not able to find fancyimpute on https://anaconda.org/search
Have not tried it (on windows), but as this package is on PyPI, usually
pip install fancyimpute
does work.
If you have multiple virtual Python environments on your Anaconda, and you want to install fancyimpute for one of them, let's call it virtual environmen py36, you can do it in the following way:
Open terminal, activate py36 using:
source activate py36
Under the activated virtual environment, install fancyimpute
pip install fancyimpute
Go to Anaconda, in environment py36 page, click Update index, and search fancyimpute for the installed, you should see it successfully installed: