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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named _C #27476

Closed
PyExtreme opened this issue Oct 7, 2019 · 2 comments
Closed

No module named _C #27476

PyExtreme opened this issue Oct 7, 2019 · 2 comments

Comments

@PyExtreme
Copy link

馃悰 Bug

While running the command, pytest test/test_cpp_api_parity.py -k Loss -v, I am getting the following error:


ImportError while importing test module '/home/ankit_jha/test/pytorch/test/test_cpp_api_parity.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_cpp_api_parity.py:10: in <module>
    import torch
torch/__init__.py:81: in <module>
    from torch._C import *
E   ImportError: No module named _C

I have build PyTorch in develop mode. I have to push some changes to C++ Frontend. Since, I am new to PyTorch, I am not sure if it's because of my environment or if it is a bug.

  • OS (e.g., Linux): Ubuntu 18.04
  • How you installed PyTorch (conda, pip, source): pip
  • Build command you used (if compiling from source): python setup.py develop
  • Python version: 3.6
@driazati
Copy link
Contributor

driazati commented Oct 7, 2019

You could try running the test from another directory, this sometimes happens if there is a file named torch.py or (more likely in this case) a folder named torch/ with an __init__.py inside, then import torch tries to import that directly instead of the installed/symlinked version in your Python's site-packages.

Something might be getting installed incorrectly, the import my_module resolution rules can be found here.

Similar issues #574, #17203, #7

@soumith
Copy link
Member

soumith commented Oct 8, 2019

closing via david's comments

@soumith soumith closed this as completed Oct 8, 2019
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

No branches or pull requests

3 participants