-
Notifications
You must be signed in to change notification settings - Fork 12
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
Dev environment: "ImportError: attempted relative import with no known parent package" #209
Comments
@hrshdhgd can you advice on this? Joe I am also using pycharm and I don't have that problem.. it must be something about how your project is set up! |
I had experienced this problem before and not any more. I think this is IDE related. I use VS code. Let me jog my memory to figure out what I did to solve it. |
@matentzn I think you're right. Harshad was very helpful and gave some suggestions for alternative setups. I tried that, but no go so far. Very curious to what your set up is, Nico! Mainly:
|
Thanks Nico. I tried that but I got a different error. I've tried I just did a fresh install of
Using
and if i unmark sources as root, I get the error I got before:
There must be something else about your set up. Anyway, for now I'll probably just use absolute imports for development, then change them back to relative when I submit my final pull request. |
What is good is that tox at least works now.. but yeah as for the rest, I have waaaaay out of my depths! |
Description
Due to use of relative imports, e.g.
from .cli
instead of absolute imports, e.g.from sssom.cli
, I'm getting the error:I've seen this problem a lot in the past, and unfortunately I've never found a reliable way to get relative imports to work in all situations where I might be running my codebase. On the other hand, anytime I've used absolute imports, my code has worked in all situations/environments.
Errors
Short err:
ImportError: attempted relative import with no known parent package
Long err:
What I've tried
Additional info
Pycharm debug config:

Possible solutions
The text was updated successfully, but these errors were encountered: