Pip freeze gives me this error related with git
Asked Answered
I

3

7

I am working with python and git on a simple Turbogears2 project that I've built just for fun. In a certain moment I want to deploy it to Heroku, so I do the usual pip freeze > requirements.txt and I get this error:

Error when trying to get requirement for VCS system Command /usr/bin/git config
remote.origin.url failed with error code 1 in /home/ricardo/myprojs/hellotg22/example,
falling back to uneditable format

And in the requirements.txt that it produces, listed between all the dependencies, I find this line, whi doesn't look good at all:

...
decorator==3.4.0
## !! Could not determine repository location
example==0.1dev
...

Does any body know what the problem is?

Anyway, I have managed to obtain the requirements.txt file, but I would like to know what is going on with that error.

Incendiary answered 28/10, 2013 at 23:32 Comment(0)
C
9

Your git repository doesn't have an "origin" so pip is unable to detect the remote url of the repository. This should have been already fixed in PIP as stated in https://github.com/pypa/pip/issues/58

Try to upgrade pip or add a remote origin to your git repository

Conchiferous answered 29/10, 2013 at 7:53 Comment(3)
Hi. I have updated pip with sudo pip install --upgrade distribute within its virtual environment, but it is still giving me the same error.Incendiary
But adding the remote, seems to have solved the issue. Thank you!Incendiary
I had this same error but even with my remote origin there, it still produces the error. Any ideas?Loupgarou
M
7

I was getting this error while working in an editable install (pip install -e .) of my project. So I added a localhost remote (git remote add origin git@localhost:the_project_name) and now pip freeze doesn't complain anymore. I got the idea from https://linuxprograms.wordpress.com/2010/05/10/how-to-set-up-a-git-repository-locally/

Manzanares answered 11/8, 2015 at 14:50 Comment(1)
Adding an origin clearly resolves it. The idea of this dummy origin is really neat though.Material
A
0

Try using pip freeze -l since it also works within a virtual environment. So your command would then be pip freeze -l > requirements.txt. I use this and it works just fine.

According to the help menu:

Freeze Options:
  -l, --local                 If in a virtualenv that has global access, do not output globally-
                              installed packages.
Apfel answered 11/3, 2014 at 13:28 Comment(1)
I see that you had the same issue on Github. Did this solution actually work for you? (Same results for me.)Embattle

© 2022 - 2024 — McMap. All rights reserved.