Search code examples
pythonpycharmgitlabrepositorypypi

Add private pypi repository to Pycharm from GItlab


I'm trying to connect PyCharm to a new gitlab repository we have on a local server. I have published a library package lets call package-name

I can use

pip install package-name --extra-index-url http://token:token_key@<server>/api/v4/projects/<project_id>/packages/pypi/simple --trusted-host <server>

using the terminal with my venv activated, and it will install without issue.

However, when I try that same URL inside of Pycharm>Settings>Project Interpreter> Add package > Manage Repositories > "URL HERE"

http://token:token_key@<server>/api/v4/projects/<project_id>/packages/pypi/simple

I get errors (usually a 404 error which seems to indicate the url isn't found.) Why does it work one way and not the other? And more importantly how do I get it to work so I don't have to type in that long url each time I want to install a package from the repository?

How do you install a gitlab pypi style package registry (repository for packages) in pycharm?

Preferrably, I would be to find the package name in the list of packages sound in Settings> Python Interpreter>Add package (+) that includes both pypi and local packages together.


Solution

  • This is a known issue in PyCharm.

    A fix has been implemented in PyCharm 2022.1 (which has not yet been released, but is available for preview evaluation).