I am on Windows 7 with python 3.5.4 and Pycharm Community Edition 2017.2
When I execute my python script in the cmd.exe it works fine. But when using the Run or Debug tools in Pycharm I get this error:
Traceback (most recent call last):
File "C:\Users\xy\my_project\env\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\xy\AppData\Local\Continuum\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
Now I am familiar with this specific error. Usually this occures if Microsoft Visual C++ Redistributable (or Visual Studio) is not installed. But this is not the case since I have installed the Microsoft Visual C++ 2015 Redistributable Update 3 (that's why the python script is working on the console).
My guess is, that I have to add some Path to Pycharm? But I do not know where or which one.
This is how I resolved the issue:
Open cmd.exe -> Create virtual env -> start Pycharm (pycharm.bat) from there
Related
I'm trying to compile a python project including numpy and pandas with nuitka but no matter how I compile it, I have an error when launching the final executable.
For compilation I use the next command :
python -m nuitka --standalone --follow-imports --plugin-enable=numpy --include-plugin-directory=.venv/lib/python3.6/site-packages/pandas --include-plugin-directory=.venv/lib/python3.6/site-packages/numpy --show-progress --show-scons newick2phylipmatrix.py
But when I try to launch the executable generated by the compilation I get the following message :
Traceback (most recent call last):
File "/home/mindsound/sandbox/distMatrix/newick2phylipmatrix.dist/newick2phylipmatrix.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/home/mindsound/sandbox/distMatrix/newick2phylipmatrix.dist/pandas/__init__.py", line 22, in <module pandas>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/home/mindsound/sandbox/distMatrix/newick2phylipmatrix.dist/pandas/compat/numpy/__init__.py", line 3, in <module pandas.compat.numpy>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/home/mindsound/sandbox/distMatrix/newick2phylipmatrix.dist/distutils/__init__.py", line 11, in <module>
AttributeError: module 'opcode' has no attribute '__file__'
Currently without changing anything to the code, I manage to create a standalone with pyinstaller but I can't do it with nuitka but if it's possible I would like to use it to benefit from compilation optimization.
Do you have any idea where this problem comes from and whether it can be solved ?
Well i finally got the solution for the same. The distutils created / copied by the virtualenv while creation is different from the one in the pythons original distribution. One of the teammember at Nuitka helped me discover the same and helped me reach the solution. Well the option i discovered was to pick up the distutils from the Pythons lib folder and replace the existing distutils folder in the virtualenv folder created and the go ahead - compile the same. I believe strongly that the issue will go away for you too as it have gone away for mine. Now will be looking to get in the proper solution for my complete project work.
Happy Compilation :)
I did an installation on android using the follow commands on android:
apt install python
pip install scapy
everything is fine for now, but when i run scapy i got this error -----see error
This error does not happen to me in conda or kali, it appears to be exclusive for android.
ERROR: Loading module scapy.layers.netflow
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/scapy/main.py", line 143, in _load
mod = importlib.import_module(module)
File "/data/data/com.termux/files/usr/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/scapy/layers/netflow.py", line 112, in <module>
class NetflowRecordV5(Packet):
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/scapy/layers/netflow.py", line 127, in NetflowRecordV5
ByteEnumField("prot", IP_PROTOS["tcp"], IP_PROTOS),
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/scapy/dadict.py", line 49, in getitem
return getattr(self, attr)
AttributeError: 'DADict' object has no attribute 'tcp'
The android device is rooted. I hope someone is familiar with this error and can help. Thanks
i did this on my phone but it looks require root access
I have a python function that I've created as an Azure App Function. It works on my local machine fine, however fails with no descriptive error when executed after a successful publishing.
Originally, it failed with 500 internal server error due to:
Result: Failure
Exception: ModuleNotFoundError: No module named 'pandas'
Stack: File "/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/azure/functions_worker/dispatcher.py", line 218, in _handle__function_load_request
func_request.metadata.entry_point)
File "/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/azure/functions_worker/loader.py", line 66, in load_function
mod = importlib.import_module(fullmodname)
File "/root/.pyenv/versions/3.6.8/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/site/wwwroot/generateGraph/__init__.py", line 2, in <module>
import pandas as pd
I thought this was me not publishing with the --build-native-deps switch. So I republished with this switch: (.env) C:\Temp\python_function>func azure functionapp publish httpGenGraph --build-native-deps
And publishing was successful. Now, when I execute the Http Trigger, I get the same error again. Is there something I'm missing? I'm new to Python so it could be not understanding the packaging requirements or something. The function does work within my local virtual python environment.
Figured it out. I needed to pipe the output of pip freeze to the requirements.txt file. This allowed the packages to be properly referenced when publishing.
For reference:
(.env) C:\Temp\python_function>pip freeze > requirements.txt
Then:
(.env) C:\Temp\python_function>func azure functionapp publish httpGenGraph --build-native-deps
I want to use XGBoost. When I try to execute code it always shows this error given below.
Exception has occurred: xgboost.core.XGBoostError
XGBoost Library (xgboost.dll) could not be loaded. Likely causes: * OpenMP
runtime is not installed (vcomp140.dll or libgomp-1.dll for Windows,
libgomp.so for UNIX-like OSes) * You are running 32-bit Python on a 64-bit
OS Error message(s): ['[WinError 193] %1 is not a valid Win32 application']
File "G:\study\research\gbm\<frozen importlib._bootstrap>", line 205,
in _call_with_frames_removed
File "G:\study\research\gbm\<frozen importlib._bootstrap_external>",
line 678, in exec_module
File "G:\study\research\gbm\<frozen importlib._bootstrap>", line 655,
in _load_unlocked
File "G:\study\research\gbm\<frozen importlib._bootstrap>", line 950,
in _find_and_load_unlocked
File "G:\study\research\gbm\<frozen importlib._bootstrap>", line 961,
in _find_and_load
File "G:\study\research\gbm\<frozen importlib._bootstrap>", line 205,
in _call_with_frames_removed
File "G:\study\research\gbm\<frozen importlib._bootstrap_external>",
line 678, in exec_module
File "G:\study\research\gbm\<frozen importlib._bootstrap>", line 655,
in _load_unlocked
File "G:\study\research\gbm\<frozen importlib._bootstrap>", line 950,
in _find_and_load_unlocked
File "G:\study\research\gbm\<frozen importlib._bootstrap>", line 961,
in _find_and_load
File "G:\Study\Research\GBM\gbm.py", line 4, in <module>
from xgboost import XGBClassifier
I install xgboost, downloaded the dll file and installed it.
For me even though everything was on 64-bit I still got this error.
Finally I found XGBoost requires Visual Studio 2017 C++ Redistributable installed in the windows machine..
I installed "plugged in" Python as a plug in into Netbeans using from here. I was using Eclipse, and even though it was a little wonky, it could at least find Pyserial. Now, when I try to run a project (which worked fine in Eclipse), I get the following error:
Traceback (most recent call last):
File "G:\Prog\PythonCurrent\RadioDB\src\radiodb.py", line 8, in <module>
import serial
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "c:\Python34\lib\site-packages\pyserial-2.7-py3.4-win32.egg\serial\__init__.py", line 19, in <module>
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "c:\Python34\lib\site-packages\pyserial-2.7-py3.4-win32.egg\serial\serialwin32.py", line 12, in <module>
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2222, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 2164, in _find_spec
File "<frozen importlib._bootstrap>", line 1940, in find_spec
File "<frozen importlib._bootstrap>", line 1916, in _get_spec
File "<frozen importlib._bootstrap>", line 1897, in _legacy_get_spec
File "<frozen importlib._bootstrap>", line 863, in spec_from_loader
File "<frozen importlib._bootstrap>", line 904, in spec_from_file_location
File "c:\Python34\lib\site-packages\pyserial-2.7-py3.4-win32.egg\serial\win32.py", line 196
MAXDWORD = 4294967295L # Variable c_uint
^
SyntaxError: invalid syntax
I don't understand why. My python34\Lib directory contains searial's stuff, and in python34\Lib\site-packages I have the same folder in addition to pyserial's egg and egg-info files. Do I need to specify where these are in Netbeans or copy some folders to Netbeans?
SOLUTION:
Thanks #Padraic Cunningham
I just like to make sure that the solution is clear for anyone because I have been lost before (like anyone at first).
Sooo, the solution is use pip3 install pyserial to install for python3...
I like to make cmd doskey macros, so I'll probably do that, but the easiest thing to install something with "pip3" is go to cmd.exe/terminal and then go to python home directory, then cd to scripts; type pip3.exe install pyserial or whatever you are installing (you can use pip3.4.exe... if you have it) and voila... easiest thing in the world if you know about it.
#PadraicCunningham
use pip3 install pyserial to install almost major packages.
Pyserial isn't updated to Python 3 yet, it only works in Python 2. So change your interpreter to Python 2.7.