question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

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:closed
  • Created 6 years ago
  • Comments:46 (46 by maintainers)

github_iconTop GitHub Comments

1reaction
kennethreitzcommented, Sep 14, 2017

unless they’re within the codebase

1reaction
AlJohricommented, Sep 14, 2017

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found