Slycot Import Error: DLL load failed - python

I have installed Slycot successfully on other windows machines, but I am running into an error I have not seen before while attempting to install it on my work desktop. My usual procedure is as follows:
Install PythonXY
Download Microsoft Visual C++ 2008 and SP1 using link from http://www.lfd.uci.edu/~gohlke/pythonlibs/
Download and install Slycot from binary provided in http://www.lfd.uci.edu/~gohlke/pythonlibs/
This has worked before, and it appeared to install with no issues, but I get the following error when I try to import slycot:
>>> import slycot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\slycot\__init__.py", line 5, in <module>
from slycot.analysis import ab01nd,ab05md,ab05nd,ab07nd,ab08nd, ab09ad
File "C:\Python27\lib\site-packages\slycot\analysis.py", line 21, in <module>
from slycot import _wrapper
ImportError: DLL load failed: The specified module could not be found.
>>>
I went to the location of the source in thhe site-packages directory and indeed the _wrapper.pyd file is there. Any ideas why it can't find the DLL?

I re-installed PythonXY and followed my original procedure and the installation worked the second time around. I'm chocking it up to humidity issues (-;

Related

CuPy CUDA - Failed to Import CuPy

I have installed the correct version of CuPy with pip install cupy-cuda117 on pyCharms as my CUDA is version 11.7. My Python version is 3.8. I also have the environment variables set but I am still receiving this message:
Traceback (most recent call last):
File "C:\Users\Dominic\PycharmProjects\Project_Trading\venv\lib\site-packages\cupy\__init__.py", line 18, in <module>
from cupy import _core # NOQA
File "C:\Users\Dominic\PycharmProjects\Project_Trading\venv\lib\site-packages\cupy\_core\__init__.py", line 1, in <module>
from cupy._core import core # NOQA
File "cupy\_core\core.pyx", line 1, in init cupy._core.core
File "C:\Users\Dominic\PycharmProjects\Project_Trading\venv\lib\site-packages\cupy\cuda\__init__.py", line 8, in <module>
from cupy.cuda import compiler # NOQA
File "C:\Users\Dominic\PycharmProjects\Project_Trading\venv\lib\site-packages\cupy\cuda\compiler.py", line 13, in <module>
from cupy.cuda import device
File "cupy\cuda\device.pyx", line 1, in init cupy.cuda.device
ImportError: DLL load failed while importing runtime: The specified module could not be found.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:/Users/Dominic/PycharmProjects/Project_Trading/regression_to_classification.py", line 77, in <module>
import cupy
File "C:\Users\Dominic\PycharmProjects\Project_Trading\venv\lib\site-packages\cupy\__init__.py", line 20, in <module>
raise ImportError(f'''
ImportError:
================================================================
Failed to import CuPy.
If you installed CuPy via wheels (cupy-cudaXXX or cupy-rocm-X-X), make sure that the package matches with the version of CUDA or ROCm installed.
On Linux, you may need to set LD_LIBRARY_PATH environment variable depending on how you installed CUDA/ROCm.
On Windows, try setting CUDA_PATH environment variable.
Check the Installation Guide for details:
https://docs.cupy.dev/en/latest/install.html
Original error:
ImportError: DLL load failed while importing runtime: The specified module could not be found.
================================================================
Process finished with exit code 1
Here is some additional info:
I ran into something similar when trying to install cupy recently. These are the steps that ultimately resulted in the import error:
Try to pip install cupy.
Realize that this is taking too long and/or requires a compiler etc.
Stop the install/build.
Install one of the prebuilt wheels (e.g. pip install cupy-cuda11x).
Notice that the cupy package is somehow installed (probably a remnant from the first stage).
pip uninstall cupy to get rid of the cupy library which shouldn't be there. << This is the stage that causes the problem!
The last step above breaks whichever mappings the wheel installer creates that allow one to import cupy despite installing a package called e.g. cupy-cuda11x.
The solution that worked for me was to remove all cupy* packages and install only the wheel distribution. In the case shown in the question, reinstalling cupy-cuda11x should do the trick.

python-docx package is giving errors in script

I installed this python package using pip that was compatible with Python 2.7, in a windows machine. I tried newer versions of the python-docx but those ones did not download properly. Only version 0.8.7 installed successfully and so I am using it right now. I installed it using:
pip install python-docx==0.8.7
But I think it installed a 32 bit version of this package and I am using a 64 bit machine. I know this because while I tried to run my python program using this package I got the error:
Traceback (most recent call last):
File "C:/projects/engine_script/Tools/subprocess_module/create_doc.py", line 2, in <module>
from docx import Document
File "C:\Python27\lib\site-packages\docx\__init__.py", line 3, in <module>
from docx.api import Document # noqa
File "C:\Python27\lib\site-packages\docx\api.py", line 14, in <module>
from docx.package import Package
File "C:\Python27\lib\site-packages\docx\package.py", line 11, in <module>
from docx.opc.package import OpcPackage
File "C:\Python27\lib\site-packages\docx\opc\package.py", line 12, in <module>
from .part import PartFactory
File "C:\Python27\lib\site-packages\docx\opc\part.py", line 12, in <module>
from .oxml import serialize_part_xml
File "C:\Python27\lib\site-packages\docx\opc\oxml.py", line 12, in <module>
from lxml import etree
ImportError: DLL load failed: %1 is not a valid Win32 application.
This is where the package got downloaded to: C:\Python27\Lib\site-packages\lxml-3.3.5-py2.7-win32.egg
Anyone have the link to the 64 bit version (win_amd64.whl) of this package? I tried searching in this link(https://www.lfd.uci.edu/~gohlke/pythonlibs/) but could not find the package I was looking for. I even have the latest lxml package and the package is still not working as the script shows errors.

Runtime error: Freetype library not found

I am running Glumpy on python 3.7.2 and windows 10. I keep getting this error EVEN AFTER installing through pip.
Traceback (most recent call last):
File "C:\Users\algeb\Downloads\Animoji-Animate-master\animate.py", line 3, in <module>
from glumpy import app, gloo, gl
File "C:\Users\algeb\AppData\Local\Programs\Python\Python37-32\lib\site-packages\glumpy\__init__.py", line 7, in <module>
from . import app
File "C:\Users\algeb\AppData\Local\Programs\Python\Python37-32\lib\site-packages\glumpy\app\__init__.py", line 16, in <module>
from glumpy.ext.inputhook import inputhook_manager, stdin_ready
File "C:\Users\algeb\AppData\Local\Programs\Python\Python37-32\lib\site-packages\glumpy\ext\__init__.py", line 6, in <module>
from . import freetype
File "C:\Users\algeb\AppData\Local\Programs\Python\Python37-32\lib\site-packages\glumpy\ext\freetype\__init__.py", line 49, in <module>
raise RuntimeError('Freetype library not found')
RuntimeError: Freetype library not found
Per discussion in the comments above, the problem seems to have been that Glumpy requires the freetype package, which requires the FreeType library to be installed. You can download Windows binaries for FreeType, e.g., here. Make sure to download the .dll for the correct platform (in your case, that would seem to be 64-Bit now). Once downloaded, place the .dll somewhere on your machine and add the path to the directory where it's located to the PATH environment variable. Then the freetype package should be able to find it. More detailed installation instructions can be found in the freetype package Readme.
For me it helped to install the Microsoft C++ Redistributable from https://visualstudio.microsoft.com/en/downloads/

ImportError: C extension: No module named 'parsing' not built

I have been trying to find a solution to this import error regarding the pandas library when it says no module named "parsing." Every library should be installed correctly from the interpreter and they are all the latest version.
This is what the console returns:
Traceback (most recent call last):
File "C:\Users\shaya\PycharmProjects\NEA\venv\lib\site-packages\pandas\__init__.py", line 26, in <module>
from pandas._libs import (hashtable as _hashtable,
File "C:\Users\shaya\PycharmProjects\NEA\venv\lib\site-packages\pandas\_libs\__init__.py", line 4, in <module>
from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
File "pandas\_libs\tslibs\conversion.pxd", line 11, in init pandas._libs.tslib
File "pandas\_libs\tslibs\conversion.pyx", line 40, in init pandas._libs.tslibs.conversion
ModuleNotFoundError: No module named 'parsing'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/shaya/PycharmProjects/NEA/Main.py", line 4, in <module>
import pandas_datareader.data as data
File "C:\Users\shaya\PycharmProjects\NEA\venv\lib\site-packages\pandas_datareader\__init__.py", line 2, in <module>
from .data import (DataReader, Options, get_components_yahoo,
File "C:\Users\shaya\PycharmProjects\NEA\venv\lib\site-packages\pandas_datareader\data.py", line 7, in <module>
from pandas_datareader.av.forex import AVForexReader
File "C:\Users\shaya\PycharmProjects\NEA\venv\lib\site-packages\pandas_datareader\av\__init__.py", line 3, in <module>
from pandas_datareader.base import _BaseReader
File "C:\Users\shaya\PycharmProjects\NEA\venv\lib\site-packages\pandas_datareader\base.py", line 7, in <module>
import pandas.compat as compat
File "C:\Users\shaya\PycharmProjects\NEA\venv\lib\site-packages\pandas\__init__.py", line 35, in <module>
"the C extensions first.".format(module))
ImportError: C extension: No module named 'parsing' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
All of the above tracebacks are from PyCharm.
OS: Windows.
I am using pip to install packages
Python version: 3.7.1, panda version: 0.23.4
Do you have python added to path? To test this; open a cmd and type python. If it is on your path, you should see the version of python you are running (Assuming you are using a windows machine). If this is the case, you can simply run the command after you checked this. If not, please navigate to the location where Python is installed, open python.exe and try to run the command python setup.py build_ext --inplace --force
If this doesn't work, you should try to re-install pandas by pip install --upgrade --force-reinstall pandas
If this also fails you could also go rigourous, and simply create a new environment and install pandas there. Sidenote: It is probably better to install pandas by using conda package manager, Pandas has portions of its code written in C to make it run faster. If you tried to install pandas manually you would need to build it.
I had the same problem under the same circumstances. I went through the code of some of the pandas files and saw that there is indeed a module named 'parsing' in the tslib folder of my pandas directory, yet for some reason it's not able to call it. I just reinstalled python and now it's working for me. If you find any other alternative, please let me know.

Can't find submodule in package

I'm using Anaconda3 version 4.2.0 on ubuntu (in docker).
Anaconda is installed in /root/anaconda3 folder.
I installed theano_bpr package using pip install theano_bpr.
Now when i open python and try import theano_bpr, i get the following message:
>>> import theano_bpr
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/anaconda3/lib/python3.5/site-packages/theano_bpr/__init__.py", line 17, in <module>
from bpr import BPR
ImportError: No module named 'bpr'
However, when i navigate to /root/anaconda3/lib/python3.5/site-packages/theano_bpr/ and run python there, i'm able to import theano_bpr.
In /root/anaconda3/lib/python3.5/site-packages/theano_bpr/ there are following files:
__init__.py, bpr.py (this one is causing problems), t.py, and utils.py.

Categories

Resources