0

I didn't make any change but it suddenly doesn't work.

>>> import torch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/cheng/anaconda/envs/py36/lib/python3.6/site-packages/torch/__init__.py", line 56, in <module>
    from torch._C import *
ImportError: numpy.core.multiarray failed to import

I tried pip install numpy -I but it didn't work.

My OS is Mac OS X, and I tried to install by both pip and conda. Reinstall the env didn't work as well.

pytorch version 0.3.1

numpy version 1.14.2

Solution:

Do not name your file tokenize.py!

2
  • How do you install pytorch. What is your system? Does pip install -U numpy work you? Commented Apr 3, 2018 at 13:37
  • @jdhao No it didn't work. Commented Apr 3, 2018 at 14:25

2 Answers 2

1

Solution according to OP:

A file named tokenize.py in the current directory caused this issue.

Sign up to request clarification or add additional context in comments.

Comments

0

I'd same error and I solved it with change version of numpy.

Result of import torch

$ python

Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.

import torch

** On entry to DGEBAL parameter number 3 had an illegal value

** On entry to DGEHRD parameter number 2 had an illegal value

** On entry to DORGHR DORGQR parameter number 2 had an illegal value

** On entry to DHSEQR parameter number 4 had an illegal value

Traceback (most recent call last):

File "", line 1, in

File "C:\Projects\Aspose\lib\site-packages\torch_init_.py", line 190, in from torch._C import *

ImportError: numpy.core.multiarray failed to import

Result of import numpy

import numpy

** On entry to DGEBAL parameter number 3 had an illegal value

** On entry to DGEHRD parameter number 2 had an illegal value

** On entry to DORGHR DORGQR parameter number 2 had an illegal value

** On entry to DHSEQR parameter number 4 had an illegal value

Traceback (most recent call last):

File "", line 1, in

File "C:\Projects\Aspose\lib\site-packages\numpy_init_.py", line 305, in win_os_check()

File "C:\Projects\Aspose\lib\site-packages\numpy_init.py", line 302, in _win_os_check raise RuntimeError(msg.format(file)) from None

RuntimeError: The current Numpy installation ('C:\Projects\Aspose\lib\site-packages\numpy\init.py') fails to pass a sanity check due to a bug in the windows runtime.

Solution:

pip uninstall numpy

pip install numpy==1.19.3

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.