issues with relative packages
See original GitHub issue@kennethreitz I’m having trouble installing local packages in relative directories via -e
.
![screen shot 2017-09-13 at 7 54 55 pm](https://user-images.githubusercontent.com/2790092/30406072-7008675e-98bd-11e7-8a60-bfb9f57cfe10.png)
This is the initial requirements.txt file:
-e ../../lib/python
arrow==0.10.0
blessings==1.6
boto3==1.4.7
This is what the converted Pipfile looks like:
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
[packages]
"-e file:///users/johria/development/heliograf/lib/python" = "*"
arrow = "==0.10.0"
blessings = "==1.6"
heliograf
in this case is the name in setup.py of the relative package.
I believe the issue may be that the Pipfile.lock doesn’t have the directory?
"heliograf": {
"hashes": [],
"version": "==0.1.0"
},
While the above is starting from the requirements.txt, this kind of works: pipenv install -e ../../lib/python
It adds another entry into the Pipefile like this:
"-e ../../lib/python" = "*"
I can see that the package is installed properly by running pipenv run python
and importing the package. In addition, doing a pipenv shell
followed by a pip freeze
shows:
-e git+git@github.com:WPMedia/heliograf.git@4dbd528e2f2daeb4b4462b29d2dc8c54341428b5#egg=heliograf&subdirectory=lib/python
potentially related issues:
versions:
- python version: 3.6.2
- pipenv version: 7.0.1
- python installed via: pyenv
Issue Analytics
- State:
- Created 6 years ago
- Comments:46 (46 by maintainers)
Top Results From Across the Web
Relative import problem with python packages
1. add the following code at the top of the utils and summarygenerator and try: import os import sys sys. · 3. This...
Read more >Relative vs package imports in Flutter and Dart | by Suragch
It's OK to use relative imports and it's OK to use package imports. Mixing relative imports and package imports can potentially cause problems....
Read more >attempted relative import with no known parent package
How to fix ImportError: attempted relative import with no known parent package. Learn why it happens and Python import best-practices.
Read more >eslint-plugin-no-relative-import-paths - npm package
Learn more about eslint-plugin-no-relative-import-paths: package health ... Ensure you're using the healthiest npm packages ... No known security issues.
Read more >Absolute vs Relative Imports in Python
Best practice is probably to avoid relative imports from other package two levels above in the file-system hierachy, but inside one package importing...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
unless they’re within the codebase
@techalchemy I think you misunderstand - this isn’t a published package anywhere, it isn’t installed directly from VCS, its installed from a relative path to my project. I don’t intend to pin any specific version, I just want it installed as an editable package.
@kennethreitz that fixed it! I’d love to continue using a relative path in the Pipefile so I can use the same Pipfile with my collaborators. I also noticed that the Pipefile seemed to lowercase the whole filepath but that didn’t affect anything.