Use package from Github in Conda Virtual Environment

社会主义新天地 提交于 2020-12-29 06:59:25

问题


Setup

  • Conda virtual environment
  • Coding in a Jupyter notebook
  • Python version 3.6

I have Googled, searched through the Conda help, github help on this site as wel as found closely relevant questions, that just don't answer mine:

  • Conda install package from github including requirements.txt
  • Conda: installing local development package into single conda environment

That first one comes close though.

Basically my question comes down to:

For my code to work i need to import this repo: https://github.com/nicocanali/airtable-python

How can I get this to be used in my Jupyter Notebook?

I'll need to add it to my virtual environment. But how?


回答1:


I ended up doing the following:

  1. Install git in the virtual environment: (conda install git)
  2. Clone the project. (git clone [URL])
  3. Install the package (cd to package directory that contains setup.py.
  4. Then run "python setup.py install").

Found the answer in the first part in this video: How to Install Python Package from GitHub




回答2:


Found a simple solution here:

https://medium.com/i-want-to-be-the-very-best/installing-packages-from-github-with-conda-commands-ebf10de396f4

For example, to install the package located at https://github.com/Netflix/metaflow, navigate to your desired environment in the Anaconda prompt, activate the environment, and then execute the following commands:

conda install git
conda install pip
pip install git+git://github.com/Netflix/metaflow.git

(Note that the git package is available in Anaconda Navigator, so can be installed from there instead of from the Anaconda prompt.)




回答3:


To install https://github.com/nicocanali/airtable-python to your jupyter.

Download the .zip of the repo from the github website.

To install it in jupyter enter the following command from the anaconda console.

pip install [path_to_.zip_file_on_pc]

Works on any github file



来源:https://stackoverflow.com/questions/46076754/use-package-from-github-in-conda-virtual-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!