Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install python package with a different name using PIP

When installing a new python package with PIP, can I change the package name because there is another package with the same name?

Or, how can I change the existing package's name?

like image 519
user3562812 Avatar asked Dec 05 '14 03:12

user3562812


People also ask

How do I install a specific version of a Python package using pip?

How do I Install a Specific Version of a Python Package? To install a specific version of a Python package you can use pip: pip install YourPackage==YourVersion . For example, if you want to install an older version of Pandas you can do as follows: pip install pandas==1.1.

How do I install another Python package?

To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.


1 Answers

It's not possible to change "import path" (installed name) by specifying arguments to pip. All other options require some form of "changes to the package":

A. Use pip install -e git+http://some_url#egg=some-name: that way even if both packages have the same import path, they will be saved under different directories (using some-name provided after #egg=). After this you can go to the source directories of packages (usually venv/src/some-name) and rename some folders to change import paths

B-C. Fork the repository, make changes, then install the package from that repository. Or you can publish your package on PyPI using different name and install it by name

D. use pip download to put one of the packages in your project, then rename folders as you like

like image 182
imposeren Avatar answered Sep 29 '22 17:09

imposeren