简体   繁体   中英

pip installing from git vs cloning repo

What I did .
Following instructions, I installed the torchdiffeq package with

pip install git+https://github.com/rtqichen/torchdiffeq

What I am missing .
But that didn't clone the repository, in particular not ode_demo.py in the examples subdirectory.

Probably not the right solution .
If I clone the repo in order to get this examples subdirectory, then I will also have another copy of the torchdiffeq subdirectory, which I now already have installed (it is under ~/.pyenv/versions/torchdiffeq/lib/python3.7/site-packages/torchdiffeq ).

This just doesn't seem the right way to do things.

The correct solution with "editable mode"?
I read about editable installs , but am not sure if that has anything to do with my issue (and what is an "egg" ?).

Understanding the install process .
Is it simply looking at setup.py file and therefore only adding torchdiffeq and torchdiffeq._impl to the package list (here I am reaching the limits of my understanding of what setuptools.setup() does)? In other words, is this telling me that it is ignoring the rest of the repo?

Last remark . The git install command says:

Cloning https://github.com/rtqichen/torchdiffeq to /private/var/folders/sx/n_vsjpb907g774qmgxzmtv9r0000gn/T/pip-req-build-0uckfck8

the latter being a temporary file, which seems to have been deleted once the install completed, so I am not able to see if the entire repo ever transited there.

pip did clone the git repository as you say so yourself towards the end of your question. It was cloned in a temporary directory. pip then used this temporary to build and install the Python project into your current environment. Once this is done the temporary directory containing the cloned repository has been deleted.

The directories torchdiffeq and torchdiffeq._impl are declared as packages of this project (listed in the parameter to the packages argument of the setuptools.setup() function call in setup.py ) and are meant to actually be installed. Other directories are not meant to be installed, so pip didn't install them.

If you want to use the examples, then you can keep your own clone of the git repository and use them against the installed version of the project. Unless you want to modify the code of the project itself there is not much point in using the editable mode.

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