Skip to main content

a PIP wrapper to install PyPI packages from inside Python

Project description

py-pip PyPI - Version

Install Python packages, from inside Python.

The difference with similar solutions: py-pip passes it's sys.paths to pip, to support dynamicly added paths for e.g. Maya, Blender, ...
(Otherwise any python paths added after startup wont be detected by pip, so it can't uninstall certain installed packages, or it might install an already installed package)

Features

  • pass env vars so pip can detect installed modules in different locations (e.g. Blender dynamicaly changes the Python path on startup)
  • use pip from within Python, using the active interpreter

Instructions

import py_pip

# optional
py_pip.default_target_path = "C:/path/to/site-packages"  # defaults to no target path
py_pip.python_interpreter = "C:/path/to/python.exe"  # defaults to sys.executable

# print all py_pip commands
[print(x) for x in dir(py_pip)]

# install numpy
py_pip.install("numpy")

use case

Blender doesn't has an external Python interpreter that sets up the Blender environment (Maya has mayapy.exe).
To use pip and have it correctly detect the installed modules:

  • you need to run it from inside Blender.
  • or recreate the environment, with same Python version and Python paths.

Else you might install a module that is already by default installed in Blender, because pip failed to detect it.
This can result in clashes and weird bugs.

This might (untested) also be achievable by passing sys.path to os.environ["PYTHONPATH"] and then running one of the below "similar" pip wrappers

similar

Python pip wrappers, but without passing sys paths.

used by

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-pip-0.0.7.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

py_pip-0.0.7-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page