Skip to content

core\common.py:496: ModuleNotFoundError #24690

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

Closed
dickreuter opened this issue Jan 9, 2019 · 11 comments · Fixed by #24714
Closed

core\common.py:496: ModuleNotFoundError #24690

dickreuter opened this issue Jan 9, 2019 · 11 comments · Fixed by #24714
Labels
Needs Info Clarification about behavior needed to assess issue Usage Question
Milestone

Comments

@dickreuter
Copy link
Contributor

dickreuter commented Jan 9, 2019

In circumstances that I cannot reproduce in a small code example, I get the following error:

When looking at common.py, it seems that main does indeed not exist. Does anybody know why and under what circumstances this is called?


_tcp\work\win-na-x64-release\py3\mre_venv3\lib\site-packages\pandas\core\base.py:61: in __str__

    return self.__unicode__()

_tcp\work\win-na-x64-release\py3\mre_venv3\lib\site-packages\pandas\core\frame.py:659: in __unicode__

    width, _ = console.get_console_size()

_tcp\work\win-na-x64-release\py3\mre_venv3\lib\site-packages\pandas\io\formats\console.py:68: in get_console_size

    if com.in_interactive_session():

_tcp\work\win-na-x64-release\py3\mre_venv3\lib\site-packages\pandas\core\common.py:503: in in_interactive_session

    return check_main()

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

 

    def check_main():

>       import __main__ as main

E       ModuleNotFoundError: No module named '__main__'

 

_tcp\work\win-na-x64-release\py3\mre_venv3\lib\site-packages\pandas\core\common.py:496: ModuleNotFoundError

@gfyoung
Copy link
Member

gfyoung commented Jan 10, 2019

I believe that's IPython-specific logic, but I'm 100% familiar with the rationale behind it.

We probably could except on ModuleNotFoundError in that check as well.

cc @jreback @TomAugspurger

@WillAyd
Copy link
Member

WillAyd commented Jan 10, 2019

Can you try this on master? I don't even see the function from your traceback there so I assume you are working with an older copy of pandas (though pd.show_versions() would also be helpful)

@WillAyd WillAyd added the Needs Info Clarification about behavior needed to assess issue label Jan 10, 2019
@dickreuter
Copy link
Contributor Author

dickreuter commented Jan 10, 2019 via email

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Jan 10, 2019 via email

@dickreuter
Copy link
Contributor Author

dickreuter commented Jan 10, 2019 via email

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Jan 10, 2019 via email

@dickreuter
Copy link
Contributor Author

dickreuter commented Jan 10, 2019

WIth pylint test I mean something like the attached. It's a test that runs pylint. The pandas error occurs in a different test, but it only occurs when this pylint test is active.

image

This PR fixes the issue: #24714

@dickreuter
Copy link
Contributor Author

It looks like the source of the problem is this: https://github.com/PyCQA/pylint/blob/master/pylint/lint.py#L145

Pylint is mocking main and then pandas cannot find it. Apparently, this is related to a python bug.

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Jan 11, 2019 via email

@dickreuter
Copy link
Contributor Author

No it's python3 in my case

@dickreuter
Copy link
Contributor Author

dickreuter commented Jan 11, 2019

Actually, the line causing the issue is this: https://github.com/PyCQA/pylint/blob/master/pylint/lint.py#L153. It's only called when pylint is used in multiprocessing.

Not sure pandas should rely on main existing. Probably a fix would make sense both in pylint and pandas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Info Clarification about behavior needed to assess issue Usage Question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants