Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use package from Github in Conda Virtual Environment

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?

like image 834
Michel K Avatar asked Sep 06 '17 13:09

Michel K


People also ask

How do you import packages into a conda environment?

Usually you would open the anaconda navigator, then go to Enviroments on the left side, then at the bottom you would click "Add" to add a new enviroment. after that you click on the newly created enviroment and "open terminal". in that terminal you use: conda install -c anaconda numpy .

Can conda install pip packages?

You can install pip in the current conda environment with the command conda install pip , as discussed in Using pip in an environment. If there are instances of pip installed both inside and outside the current conda environment, the instance of pip installed inside the current conda environment is used.


2 Answers

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

like image 153
Michel K Avatar answered Oct 06 '22 00:10

Michel K


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

like image 41
Shahir Ansari Avatar answered Oct 05 '22 22:10

Shahir Ansari