简体   繁体   中英

Trying to install a pip package in Anaconda

I'm trying to follow this tutorial: https://docs.microsoft.com/en-us/azure/machine-learning/service/tutorial-data-prep

As part of this I'm trying to do a pip install of azureml as it's not available on conda. However doing a pip install will by default install it to my default python install, and not my conda install.

So I tried following the steps here: https://conda.io/docs/user-guide/tasks/manage-environments.html#using-pip-in-an-environment

However after following these steps I then launch Jupyter notebook after activating myenv, navigate to the notebook, and try and run:

import azureml.dataprep as dprep

But get the error: ModuleNotFoundError: No module named 'azureml'

Also - I cannot tell if myenv is active in the notebook. The kernel simply says python3.

Be careful, when using pip in anaconda, it is possible that you are mixing pip and pip3 .

Run which pip3 to be sure you are using the version that correspond to the virtual environment.

If you are using python3 in the environment, then pip will typically be the correct version to use. Do not use pip3 in that case.

This problem has been documented elsewhere on the web. The problem is that Jupyter notebooks itself only launches in the root environment by default. The simplest solution to getting it to launch for your env (eg myenv) is to install Jupyter within your env first. So from the Anaconda command prompt:

activate myenv
pip install jupyter
jupyter

Ps. Use source activate myenv for non-windows machines

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM