ValueError: module functions cannot set METH_CLASS or METH_STATIC

I'm getting an error when I try to install something with pip3 or uninstall anything with it. Here is the error

 File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/utils.py", line 12, in <module>
  File "/usr/lib/python3.5/cgi.py", line 39, in <module>
    from email.parser import FeedParser
  File "/usr/lib/python3.5/email/parser.py", line 12, in <module>
    from email.feedparser import FeedParser, BytesFeedParser
  File "/usr/lib/python3.5/email/feedparser.py", line 27, in <module>
    from email import message
  File "/usr/lib/python3.5/email/message.py", line 16, in <module>
    from email import utils
  File "/usr/lib/python3.5/email/utils.py", line 28, in <module>
    import random
  File "/home/user/.local/lib/python3.5/site-packages/torch/random.py", line 4, in <module>
    from torch._C import default_generator
  File "/home/user/.local/lib/python3.5/site-packages/torch/__init__.py", line 79, in <module>
    from torch._C import *
ValueError: module functions cannot set METH_CLASS or METH_STATIC
pippytorchpip3
2 votesJO220.00
1 Answers
JO220.00
2

I've already found it. I put pytorch path inside PYTHONPATH and it tries to load package named random, which have multiple sources (torch also has it). I removed the path of torch from PYTHONPATH, and it works fine now

Reply
Couldn't find what you were looking for?and we will find an expert to answer.
How helpful was this page?