Although I have been using Python for a while, I am relatively new to Anaconda, and package handling in general seems to cause a lot of problems for me.
I am trying to get xgboost up and running with Anaconda. I eventually managed to install it by using the command:
conda install -c anaconda py-xgboost
in the Anaconda prompt.
When I now try import xgboost in the PyCharm Python Console, I am given the following error:
Python 2.7.15 |Anaconda 2.5.0 (64-bit)| (default, May 1 2018, 18:37:09) [MSC v.1500 64 bit (AMD64)] on win32
Backend Qt5Agg is interactive backend. Turning interactive mode on.
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 5.0.4\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Richard\Anaconda2\lib\site-packages\xgboost\__init__.py", line 11, in <module>
from .core import DMatrix, Booster
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 5.0.4\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Richard\Anaconda2\lib\site-packages\xgboost\core.py", line 115, in <module>
_LIB = _load_lib()
File "C:\Users\Richard\Anaconda2\lib\site-packages\xgboost\core.py", line 109, in _load_lib
lib = ctypes.cdll.LoadLibrary(lib_path[0])
File "C:\Users\Richard\Anaconda2\lib\ctypes\__init__.py", line 444, in LoadLibrary
return self._dlltype(name)
File "C:\Users\Richard\Anaconda2\lib\ctypes\__init__.py", line 366, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found
I have searched for similar questions on StackOverflow, but I've had no luck, besides finding complicated answers which I did not feel comfortable implementing without fully understanding, and which I am not sure are applicable to my scenario anyway.
Some further things to note, which may be related:
Originally, I installed the package using pip install xgboost in the Pycharm Terminal before realising my mistake.
When I initially tried testing the xgboost package, I did so (stupidly) in a file named xgboost.py. I have since deleted this project. I uninstalled and reinstalled xgboost afterwards.
I have tried several things to try and resolve this issue which may have complicated things further. For example, I deleted the 'xgboost' folder from inside 'C:\Users\Richard\Anaconda2' when typing conda uninstall xgboost into the Anaconda prompt failed.
Would anyone be able to shed any light on what is causing this issue? This is my first question on stack overflow, so I apologise if my question has not been posed completely correctly with regards to the guidelines.
After further searching, I managed to answer my own question.
The xgboost (C++) library must be compiled and built before it can be used as a Python module. To do so, I carefully followed the instructions on this page:
https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en
and now, I think, xgboost is working fine. This is the first time I have encountered a package where this was required, hence the confusion. Hopefully this will help someone else who has the same issue.
Related
I am attempting to build a speech-to-text algorithm using Mozilla DeepSpeech, but I am having trouble installing the package.
First, I created a new virtual environment in Anaconda called deepspeech-venv and installed the latest version of the deepspeech package (v0.8.1) via pip in the Anaconda Powershell with the command pip install deepspeech --upgrade.
Next, I downloaded both the pbmm version and the tflite version of the pre-trained English models from Mozilla's GitHub using the commands wget https://github.com/mozilla/DeepSpeech/releases/download/v0.8.1/deepspeech-0.8.1-models.pbmm and wget https://github.com/mozilla/DeepSpeech/releases/download/v0.8.1/deepspeech-0.8.1-models.tflite.
Finally, I wanted to check and make sure that everything installed correctly, so I typed deepspeech -h into the command line, which produced the following error statement:
Traceback (most recent call last):
File "c:\users\zachary.holden\anaconda3\envs\deepspeech_venv\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\zachary.holden\anaconda3\envs\deepspeech_venv\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\zachary.holden\Anaconda3\envs\deepspeech_venv\Scripts\deepspeech.exe\__main__.py", line 4, in <module>
File "c:\users\zachary.holden\anaconda3\envs\deepspeech_venv\lib\site-packages\deepspeech\__init__.py", line 23, in <module>
from deepspeech.impl import Version as version
File "c:\users\zachary.holden\anaconda3\envs\deepspeech_venv\lib\site-packages\deepspeech\impl.py", line 13, in <module>
from . import _impl
ImportError: DLL load failed: The specified module could not be found.
From what I understand, this means that I'm lacking some dependencies for the deepspeech library; however, I'm not quite sure what additional DLLs need to be installed or even how to go about that process. (Unless, of course, if the issue lies in my installation process, and I merely have to add another library.)
NOTE: I am running Python v3.7.7 on a Windows 10 64-bit system.
I copied the "libdeepspeech.so" file from "lib" directory to directly under "deepspeech" directory as suggested in the below shared link and it worked for me.
Reference Link
When I import sklearn in python shell, I got the following error
ImportError: DLL load failed: The network path was not found.
Here is python version: 3.7.3 64 bit
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
My PC is allocated to students by the university, which is Win10 Edu, 64 bit OS. And I am the administrator
When I was using 32 bit Python, every thing was fine. I changed to 64 bit Python last week because I need to use tensorflow. And then I have problem with sklearn.
Here are the full error message
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import sklearn
File "C:\Program Files\Python37\lib\site-packages\sklearn\__init__.py", line 64, in <module>
from .base import clone
File "C:\Program Files\Python37\lib\site-packages\sklearn\base.py", line 14, in <module>
from .utils.fixes import signature
File "C:\Program Files\Python37\lib\site-packages\sklearn\utils\__init__.py", line 16, in <module>
from .fixes import _Sequence as Sequence
File "C:\Program Files\Python37\lib\site-packages\sklearn\utils\fixes.py", line 85, in <module>
from scipy.special import boxcox # noqa
File "C:\Program Files\Python37\lib\site-packages\scipy\special\__init__.py", line 641, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The network path was not found.
I tried pip list in cmd prompt and I found sklearn (version 0.0)/scikit-learn(version 0.20.3) are both installed.
I searched a lot, but I didn't find anyone having the same problem. I found this question: Error importing sklearn, looks like a different problem to me.
I have reinstall Python, reinstall sklearn (both pip and using wheel), NumPy and SciPy. I unistalled pycharm and anaconda. I also uninstall the Python 2.7 in my pc. None of these worked. Any suggestions are welcomed!
I faced the exact same error. it seems like sklearn installs wrong version of scipy. you should install sklearn first and then install scipy 1.3.0rc1 and numpy+mkl from Christoph Gohlke windows binaries.
https://www.lfd.uci.edu/~gohlke/pythonlibs/
I am pretty new to python (not so new to java). I am very interested in the AI/Machine learning aspect of python.. So I went to Udemy and got two courses.. One on python and another on AI. I fooled around with the python course then went to the AI course. One of the imports needed was (torch) So I installed the import via the anaconda prompt.. I tried to run the import and I got the error
Traceback (most recent call last):
File "C:\Users\lukem\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3267, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-4-eb42ca6e4af3>", line 1, in <module>
import torch
File "C:\Program Files\JetBrains\PyCharm 2018.3.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\lukem\Anaconda3\lib\site-packages\torch\__init__.py", line 84, in <module>
from torch._C import *
File "C:\Program Files\JetBrains\PyCharm 2018.3.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: DLL load failed: The specified module could not be found.
I then tried MANY versions of python and different ways of installing torch (pip3/cond) nothing worked.. I then uninstalled everything and all of a sudden the base import torch worked but things like (import torch.n or random) didnt work. Then all of a sudden the import torch wasn't there. Makes sense since I did uninstall everything involving torch. Current situation is I have torch downloaded
pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp37-cp37m-win_amd64.whl
and that gives me the error listed above.. I am just very stuck and I've literal wasted around 3 days searching and trying to figure everything out in general (Had issues with tensor and python versions ect)
Hopefully this all makes sense.. I've only posted on stackoverflow once before.
change init.py (https://github.com/pytorch/pytorch/issues/17203)
or please downgrade your python to 3.7.1(or 3.6.7)
I am trying to install GDCM on Windows (10, x64) so I can use the GDCM package with Python 3.6.5, and am finding it completely impossible.
I have tried every combination of:
Installing GDCM-2.8.7-Windows-x86_64, GDCM-2.8.7-Windows-x86.exe, GDCM-2.8.4-Windows-x86.exe (separately, of course)
Adding To PYTHONPATH: C:\Program Files\Python36; C:\Program Files\Python36\Lib; C:\Program Files\Python36\DLLs; C:\Program Files\Python36\Scripts; C:\Program Files\GDCM 2.8; C:\Program Files\GDCM 2.8\lib; C:\Program Files\GDCM 2.8\bin; C:\Program Files\GDCM 2.8\include; C:\Program Files\GDCM 2.8\ (and even PYTHONHOME)
Copying the files gdcm.py, gdcmswig.py and _gdcmswig.pyd into site-packages and DLLs
The best I can get is copying the above mentioned files to site-packages, which allows python to detect the gdcm package (when the files are removed from site-packages it detects nothing), but returns the error:
>>> import gdcm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python36\lib\site-packages\gdcm.py", line 68, in
<module>
from gdcmswig import *
File "C:\Program Files\Python36\lib\site-packages\gdcmswig.py", line 20, in
<module>
_gdcmswig = swig_import_helper()
File "C:\Program Files\Python36\lib\site-packages\gdcmswig.py", line 19, in
swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files\Python36\lib\importlib\__init__.py", line 126, in
import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: The specified module could not be found.
Installing the _x86 version instead returns the error "%1 is not a Valid Win32 application".
I downloaded dependencyWalker to analyse _gdcmswig.pyd, but from this I cannot understand much. The problem is not MSVCP100.dll, as I have vc_redist_x64 installed. It does mention Python34.dll, but the answer below got the exact same installer working on Python 3.6.
The solution mentioned at:
how to install gdcm python wrapping on Windows System? does not work for me.
Lastly, I cannot get python to detect the package from the Program Files/GDCM 2.8/bin, regardless of what is in PATH, PYTHONPATH, or PYTHONHOME; I don't know if this is normal or not.
I have spent hours on this, to no avail; any help is greatly appreciated.
For posterity:
For me, it seems the issue was indeed that the official provided binaries were compiled for Python 3.4; I have no idea how this person got the same installer working on Python 3.6.
The solution was to build the package binaries myself; there was no "one-click" solution. For my ridiculously convoluted adventure in troubleshooting this problem, see: https://motivatedbylaziness.wordpress.com/2018/07/06/the-impossible-journey-of-a-simple-task/
I recently had this issue, and I solved it using:
python -m pip install python-gdcm
It seems that today (2022) there is a "one-click" solution
I'm using the pywin32-216.win32-py2.6.exe package to install pywin32 on Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32. I am seeing the following post install errors. Could someone help me understand what going wrong? Thanks in advance.
Copied pythoncom26.dll to C:\WINDOWS\system32\pythoncom26.dll
Copied pythoncomloader26.dll to C:\WINDOWS\system32\pythoncomloader26.dll
Copied pywintypes26.dll to C:\WINDOWS\system32\pywintypes26.dll
FAILED to register the Python COM objects
-> Software\Python\PythonCore\2.6\Help[None]=None
-> Software\Python\PythonCore\2.6\Help\Pythonwin Reference[None]='C:\\Python26\\Lib\\site-packages\\PyWin32.chm'
Failed to register pythonwin as editor
Shortcut for Pythonwin created
Shortcut to documentation created
The pywin32 extensions were successfully installed.
Traceback (most recent call last):
File "<string>", line 372, in install
File "<string>", line 170, in RegisterCOMObjects
ImportError: No module named server.register
Traceback (most recent call last):
File "<string>", line 401, in install
File "<string>", line 226, in RegisterPythonwin
File "win32com\shell\shell.pyc", line 12, in <module>
File "win32com\shell\shell.pyc", line 10, in __load
ImportError: DLL load failed: The specified module could not be found.
Most probably pywin32 requires administrator privileges to be installed successfully. I am not sure how to do that on WinXP, but Microsoft has a page about it.
I managed to fix the problem by eventually cleaning all traces of Python 2.6 from my system and re-installing it + pywin32. It was eventually as simple as just double clicking the setup files.
Another answer for the googlers:
I has the same issue, it turns out it originated because I have installed python in the past, removed it and reinstalled it to another location.
In order to solve it I had to:
Remove old installations (Uninstall + manually from registry) - as Danish advised (both in main root and in Wow6432Node).
In the registry update the location of current location of the python folder path (in InstallPath and PythonPath).