Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the correct way to install local file-backed distributions with pipenv? #945

Closed
kstohr opened this issue Oct 21, 2017 · 6 comments
Closed

Comments

@kstohr
Copy link

kstohr commented Oct 21, 2017

Trying to install a local file-backed distribution on Heroku. Previously, using standard pip/requirements.txt Heroku detected setup.py and installed the local package automatically. Now, using pipenv, with the same structure, it does not automatically detect setup.py for some reason. Per the Heroku docs I need to provide a path to the local distribution to the requirements.txt. Or, add -e . to provoke pip to run python setup.py develop What is the pipenv equivalent?

Apologies if requiring local packages is addressed in the docs, but I didn't see it...

Python 3.6.2
pipenv, version 8.2.7
Heroku

Package installation using normal setup.py install command works fine both locally and on Heroku.
pipenv run setup.py install
heroku python setup.py install

Top-level directory structure looks like this:

├── Pipfile
├── Procfile
├── README.md
├── bin
├── resources
├── runtime.txt
├── setup.py
├── src
│   └── pblc
│   ├── init.py
│   ├── main.py
├── (package files)
└── test

Tried:
pipenv install path/to/setup.py
which in my case is just
pipenv install setup.py
Expected it to add the path to the Pipfile as a requirement

Got the following traceback:

(backend_app-Nxg7F8OH) katestohr:backend_app kate$ pipenv install setup.py
Installing setup.py…
Collecting setup.py

Error:  An error occurred while installing setup.py!
  Could not find a version that satisfies the requirement setup.py (from versions: )
No matching distribution found for setup.py

Any guidance on the best way to require a local package in Pipfile...?

@kstohr
Copy link
Author

kstohr commented Oct 21, 2017

apologies, seems related to: #939

I did try:


(backend_app-Nxg7F8OH) bash-3.2$ pipenv install -e ./setup.py
Installing -e ./setup.py…
⠦
Error:  An error occurred while installing -e ./setup.py!
./setup.py should either be a path to a local project or a VCS url beginning with svn+, git+, hg+, or bzr+

still no love.
thanks for the amazing tool...

@kstohr
Copy link
Author

kstohr commented Oct 21, 2017

...for those coming here also using heroku, temporarily resolving this by running 'python setup.py install && ' in the procfile

@techalchemy
Copy link
Member

In the meantime if you use a file:// URI that will also work, e.g. pipenv install -e file:///home/user/thing/

I will note that pipenv is not meant to be run from inside its own managed virtualenv (I noticed you have it sourced), or from inside its own subshell, so be aware that this may cause issues.

@kstohr
Copy link
Author

kstohr commented Oct 22, 2017

@techalchemy Yep, thanks! Exiting the virtual env first, plus tweaking the syntax per "Editable Dependencies" in the docs to include the single quotes and a period worked.

Here's the code.

pipenv install '-e .'

(Note: No ref to the file itself-- that's critical. Referencing the file (as in pipenv install 'e .setup.py) will cause a type error.)

(Note: this works if setup.py is in the top-level project dir. Not sure if pipenv searches recursively... )

@kstohr kstohr closed this as completed Oct 22, 2017
@techalchemy
Copy link
Member

No it doesn't. The bug we have is currently to do with traversing local relative directories specifically so if you don't make any reference to a directory (i.e. there is no / in your install command) you should be ok. For example, pipenv install requests.whl would work, but pipenv install wheels/requests.whl would not, nor would pipenv install ../wheels/requests.whl, nor would even pipenv install ./requests.whl assuming all were valid paths. This will be fixed in the near future, I should have time to dig into it this weekend.

@kstohr
Copy link
Author

kstohr commented Oct 22, 2017

Roger that.. thank you. Saw the 'file://' solution suggested above and in #939, but since the absolute path would be different in production not sure that would work in my use case... Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants