josh
josh

Reputation: 10348

Manually set package as installed in Python/pip

I'm installing the openbabel package, and it can automatically generate the necessary Python libraries during compilation. This saves a good chunk of time, since installing from source via pip takes a few minutes, and that time can be rolled into the initial compilation.

I've listed it as a requirement in my requirements.txt file, but when I go to install (pip install -r requirements.txt), it attempts to reinstall the openbabel Python library. When I run pip show or pip list, openbabel doesn't show up.

Is there a way to manually mark a package as installed so pip thinks it's installed, even if it can't find the package? Or is there a file I can create that pip will use that will tell it openbabel is installed?

Upvotes: 2

Views: 951

Answers (2)

sitic
sitic

Reputation: 539

I've created a script called pip-mark-installed to manually mark a package as installed for pip:

pip install pip-mark-installed
pip-mark-installed openbabel

The script creates the necessary .dist-info directory structure and metadata files that pip uses to determine if a package is installed.

Upvotes: 0

Navin
Navin

Reputation: 4105

Create an empty .egg-info file in your site-packages directory.

For example, on my machine I did touch /usr/lib64/python3.6/site-packages/GLWindow-1.8.0-py3.6.egg-info to trick pip3 into thinking that I've installed GLWindow.

Upvotes: 0

Related Questions