[PyCUDA] <class 'ImportError'> returned a result with an error set

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PyCUDA] <class 'ImportError'> returned a result with an error set

zqao
Hello,

I am Ziqiao, trying to use PyCUDA  to boost my calculation.
There were several attempts and I finally succeed to install PyCUDA.
However, when I try the sample code on the Wiki for a test, it shows this import error.

--------------------
Traceback (most recent call last):

  File "<ipython-input-1-44ade9f6a780>", line 1, in <module>
    runfile('D:/NICT/Python Scripts/PyCUDA_test.py', wdir='D:/NICT/Python Scripts')

  File "C:\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile
    execfile(filename, namespace)

  File "C:\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "D:/NICT/Python Scripts/PyCUDA_test.py", line 9, in <module>
    import pycuda.driver as cuda

  File "C:\Anaconda3\lib\site-packages\pycuda\driver.py", line 5, in <module>
    from pycuda._driver import *  # noqa

SystemError: <class 'ImportError'> returned a result with an error set
--------------------

My current environment is:
Win 10 64 bit
NVIDIA Quadro P1000 (with the latest driver)
Python 3.6.1 (with Anaconda 3 4.4.0)
Cuda 10.1.168_425.25 (for win 10)
Microsoft Visual Studio 14.0 (for the compiler)

I used:
pycuda-2019.1+cuda101-cp36-cp36m-win_amd64.whl
pytools-2019.1.1-py2.py3-none-any.whl
to install PyCUDA and PyTools and they ended successfully.

If anyone knows how to fix this, please let me know.
Thank you in advance!
_______________________________________________
PyCUDA mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

[PyCUDA] Re: <class 'ImportError'> returned a result with an error set

Andreas Kloeckner
Hi Ziqiao,

Do you have numpy installed on your machine? That's the only thing I can
think of as getting imported during import of the PyCUDA module. I've
not seen that error before---have you tried building from source? Or
using Christoph Gohlke's binaries?

Andreas

[hidden email] writes:

> I am Ziqiao, trying to use PyCUDA  to boost my calculation.
> There were several attempts and I finally succeed to install PyCUDA.
> However, when I try the sample code on the Wiki for a test, it shows this import error.
>
> --------------------
> Traceback (most recent call last):
>
>   File "<ipython-input-1-44ade9f6a780>", line 1, in <module>
>     runfile('D:/NICT/Python Scripts/PyCUDA_test.py', wdir='D:/NICT/Python Scripts')
>
>   File "C:\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile
>     execfile(filename, namespace)
>
>   File "C:\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
>     exec(compile(f.read(), filename, 'exec'), namespace)
>
>   File "D:/NICT/Python Scripts/PyCUDA_test.py", line 9, in <module>
>     import pycuda.driver as cuda
>
>   File "C:\Anaconda3\lib\site-packages\pycuda\driver.py", line 5, in <module>
>     from pycuda._driver import *  # noqa
>
> SystemError: <class 'ImportError'> returned a result with an error set
> --------------------
>
> My current environment is:
> Win 10 64 bit
> NVIDIA Quadro P1000 (with the latest driver)
> Python 3.6.1 (with Anaconda 3 4.4.0)
> Cuda 10.1.168_425.25 (for win 10)
> Microsoft Visual Studio 14.0 (for the compiler)
>
> I used:
> pycuda-2019.1+cuda101-cp36-cp36m-win_amd64.whl
> pytools-2019.1.1-py2.py3-none-any.whl
> to install PyCUDA and PyTools and they ended successfully.
>
> If anyone knows how to fix this, please let me know.
> Thank you in advance!
> _______________________________________________
> PyCUDA mailing list -- [hidden email]
> To unsubscribe send an email to [hidden email]
>

_______________________________________________
PyCUDA mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]

signature.asc (847 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

[PyCUDA] Re: <class 'ImportError'> returned a result with an error set

David G Grier
Hi Ziqiao,

A System Error is a C-level error and suggests that python itself is having a problem.
In short, this is never supposed to happen. I ran into the same problem recently after
upgrading my installation of python from 3.7.3 to 3.7.4. Downgrading to 3.7.3 fixed it for me.

For me, this cropped up on MacOS (Mojave) running macports python and on Ubuntu 18.04 running
the stock python installation.

All the best,

David

On Wed, Jul 17, 2019 at 11:03 AM Andreas Kloeckner <[hidden email]> wrote:
Hi Ziqiao,

Do you have numpy installed on your machine? That's the only thing I can
think of as getting imported during import of the PyCUDA module. I've
not seen that error before---have you tried building from source? Or
using Christoph Gohlke's binaries?

Andreas

[hidden email] writes:
> I am Ziqiao, trying to use PyCUDA  to boost my calculation.
> There were several attempts and I finally succeed to install PyCUDA.
> However, when I try the sample code on the Wiki for a test, it shows this import error.
>
> --------------------
> Traceback (most recent call last):
>
>   File "<ipython-input-1-44ade9f6a780>", line 1, in <module>
>     runfile('D:/NICT/Python Scripts/PyCUDA_test.py', wdir='D:/NICT/Python Scripts')
>
>   File "C:\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile
>     execfile(filename, namespace)
>
>   File "C:\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
>     exec(compile(f.read(), filename, 'exec'), namespace)
>
>   File "D:/NICT/Python Scripts/PyCUDA_test.py", line 9, in <module>
>     import pycuda.driver as cuda
>
>   File "C:\Anaconda3\lib\site-packages\pycuda\driver.py", line 5, in <module>
>     from pycuda._driver import *  # noqa
>
> SystemError: <class 'ImportError'> returned a result with an error set
> --------------------
>
> My current environment is:
> Win 10 64 bit
> NVIDIA Quadro P1000 (with the latest driver)
> Python 3.6.1 (with Anaconda 3 4.4.0)
> Cuda 10.1.168_425.25 (for win 10)
> Microsoft Visual Studio 14.0 (for the compiler)
>
> I used:
> pycuda-2019.1+cuda101-cp36-cp36m-win_amd64.whl
> pytools-2019.1.1-py2.py3-none-any.whl
> to install PyCUDA and PyTools and they ended successfully.
>
> If anyone knows how to fix this, please let me know.
> Thank you in advance!
> _______________________________________________
> PyCUDA mailing list -- [hidden email]
> To unsubscribe send an email to [hidden email]
>

_______________________________________________
PyCUDA mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]


--

_______________________________________________
PyCUDA mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

[PyCUDA] Re: <class 'ImportError'> returned a result with an error set

zqao
In reply to this post by Andreas Kloeckner
Hi Andreas,

Thank you for the advice!
That was a big hit and I fixed the problem.

In fact, I have numpy on my machine,
but it looks like the version was too old for the version of pycuda I installed.
The version of my numpy was 1.12.1 and I replaced it with 1.17.0, and the problem solved.

Thank you very much!

Ziqiao
_______________________________________________
PyCUDA mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

[PyCUDA] Re: <class 'ImportError'> returned a result with an error set

zqao
In reply to this post by David G Grier
Hi David,

Thank you for your reply!

For my case, the problem came from numpy.
I updated it, and the problem solved.

I will keep your advice in my mind
in case of hitting the same problem after updating python.

Thank you anyway!

Ziqiao
_______________________________________________
PyCUDA mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]