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

Unable to Build Documentation #20001

Closed
WillAyd opened this issue Mar 5, 2018 · 5 comments · Fixed by #20005
Closed

Unable to Build Documentation #20001

WillAyd opened this issue Mar 5, 2018 · 5 comments · Fixed by #20005

Comments

@WillAyd
Copy link
Member

WillAyd commented Mar 5, 2018

python make.py html

Traceback (most recent call last):
  File "doc/make.py", line 23, in <module>
    import pandas
ModuleNotFoundError: No module named 'pandas'

I believe a slight bug was introduced by c8859b5 in including import pandas at the top of the script. Unless the user has pandas installed as a package I don't think this module would know where to find it without modifying the path or being more explicit on import

@jorisvandenbossche

@jorisvandenbossche
Copy link
Member

The path is being modified somewhere else in the file make.py. If you inline the import inside the _process_single_doc method, does that fix the error?

@WillAyd
Copy link
Member Author

WillAyd commented Mar 5, 2018

I don't think that makes a difference. I looked but didn't see anywhere else in the file that added the project root to the import path - perhaps I'm overlooking it?

Otherwise adding something like the below fixes the issue:

DOC_PATH = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(DOC_PATH))
import pandas

@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Mar 5, 2018

@jorisvandenbossche
Copy link
Member

Can you actually try it? I hope it would work because it then comes after os.environ['PYTHONPATH'] = args.python_path, but not fully sure imports work that way.

@WillAyd
Copy link
Member Author

WillAyd commented Mar 5, 2018

Hmm OK I see what we are trying to do. I think setting os.environ['PYTHONPATH'] gives sphinx access to the import path when it compiles the module externally, but doesn't help the import mechanism specifically within the module.

I'll push a PR in a few that I think should serve both purposes

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

Successfully merging a pull request may close this issue.

2 participants