I use Anaconda 3 and I have pandas and numpy packages installed. It was working for the last few days and suddenly it stops working with the following error. I made no changes to the installation or packages. I am on a company PC so I am thinking they might have some software that is interfering with it - encryption or security software. Any insight on what this error means or what may be causing it?
Something similar happened in the past where python would not even initialize. I had to reinstall Anaconda to fix that.
Python 3.10.0 | packaged by conda-forge | (default, Nov 10 2021, 13:20:59) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\thakuran\Anaconda3\envs\SAR_Data_Processing\lib\site-packages\numpy\__init__.py", line 150, in <module>
from . import core
File "C:\Users\thakuran\Anaconda3\envs\SAR_Data_Processing\lib\site-packages\numpy\core\__init__.py", line 129, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 879, in exec_module
File "<frozen importlib._bootstrap_external>", line 1012, in get_code
File "<frozen importlib._bootstrap_external>", line 672, in _compile_bytecode
ValueError: bad marshal data (bytes object size out of range)
>>>
Related
I am trying to build a python executable for Windows OS with means of pyinstaller but it does not work.
Here is all the code:
import asyncio
import os
import time
def main():
print("Hello World!")
time.sleep(4)
if __name__ == '__main__':
os.system('cls')
main()
PyInstaller command: python -m PyInstaller main.py --name asyc_test --clean --onefile -w
System: Windows 10 OS, Intel 64bit, Python 3.10.2, pyinstaller 5.4.1
Error:
Traceback (most recent call last):
File "main.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "asyncio\__init__.py", line 39, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "asyncio\windows_events.py", line 8, in <module>
OSError: [WinError 10022] An invalid argument was supplied
I know that errors root lays in asyncio and already found this related issue, but i am not able to produce a fix. Anyone any ideas?
Thanks in advance!
I'm trying to install gdal library. i've tried the things recomended here Installing gdal python library on windows using conda (DLL load failed)
and here: https://github.com/felipunky/GISPython/blob/master/README.md
then i tried:
C:\Users\User>pip install D:\Seba\Programas\GDAL-3.3.0-cp37-cp37m-win_amd64.whl
Requirement already satisfied: GDAL==3.3.0 from file:///D:/Seba/Programas/GDAL-3.3.0-cp37-cp37m-win_amd64.whl in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (3.3.0)
WARNING: You are using pip version 20.1.1; however, version 21.1.2 is available.
You should consider upgrading via the 'c:\users\user\appdata\local\programs\python\python37\python.exe -m pip install --upgrade pip' command.
C:\Users\User>python
Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import gdal
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'gdal'
>>> from osgeo import gdal
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\osgeo\__init__.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\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 670, in _load_unlocked
File "<frozen importlib._bootstrap>", line 583, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 1043, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: No se puede encontrar el módulo especificado.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\osgeo\__init__.py", line 34, in <module>
_gdal = swig_import_helper()
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\osgeo\__init__.py", line 31, in swig_import_helper
return importlib.import_module('_gdal')
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_gdal'
>>>
any recomendation?
Thanks
conda install of gdal in windows does work.
You haven't given much to go on, but my guess is that you have not activated the conda environment into which gdal has been installed.
Normally your command prompt would look like this, if you had activated it
(gdal_env_name) C:\Users\User>python
Also, run
conda list
to check that all the expected libraries are there.
Try this once: sudo easy_install GDAL
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 :)
Recently I was installing tensorflow(gpu) for windows.
I have a graphic card with compute capability = 3.0 (compatible)
Python (3.5.2)
Cuda 8.0 (installed and working)
CudNN installed
(These are as per the tensorflow manual)
But when I installed the tensorflow
pip3 install --upgrade tensorflow-gpu
It was installed successfully.
But when I run the code in python I got the error.
Here is the log.
>>C:\Users\jagja>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\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: The specified module could not be found.
>>During handling of the above exception, another exception occurred:
>>Traceback (most recent call last):
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
>>During handling of the above exception, another exception occurred:
>>Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\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: The specified module could not be found.
>>During handling of the above exception, another exception occurred:
>>Traceback (most recent call last):
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\jagja\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
>>Failed to load the native TensorFlow runtime.
>>See https://www.tensorflow.org/install/install_sources#common_installation_problems
>>for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Can anyone figure out the problem. I have trying to work upon gpu's now, but stuck for weeks because of this error
I tried really hard to find a solution to this problem problem. I don't know which one is necessary or not for you. But lastly I did this and it worked:
You must change cudnn64_?.dll in directory C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin to cudnn64_5.dll.
I hope it work for you too.
Update
In fact you must download adequate version of CuDNN for your tensorflow. In windows 10 version 5.1 works.
Setting up the development environment for GPU computations for deep learning/ML libraries is extremely frustrating. In my experience, it helps often to start from a blank slate again if the error messages get too convoluted. But this particular error message seems to be one of the common installation problems mentioned on tensorflow's installation page. They redirect to this stackoverflow question :
On Windows, running "import tensorflow" generates No module named "_pywrap_tensorflow" error
It is extremely hard to diagnose something like this from afar. If the link doesnt help, I hope someone else can come along and help you. Good luck!
I recently installed SPARK in my MAC computer using the following command:
brew install apache-spark
Now I tried to run
pyspark but it is showing me the following error.
pyspark
Python 3.6.0 |Anaconda custom (x86_64)| (default, Dec 23 2016, 13:19:00
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last)
File "/usr/local/Cellar/apache-spark/2.1.0/libexec/python/pyspark/shell.py", line 30, in <module>
import pyspark
File "/usr/local/Cellar/apache-spark/2.1.0/libexec/python/pyspark/__init__.py", line 44, in <module>
from pyspark.context import SparkContext
File "/usr/local/Cellar/apache-spark/2.1.0/libexec/python/pyspark/context.py", line 36, in <module>
from pyspark.java_gateway import launch_gateway
File "/usr/local/Cellar/apache-spark/2.1.0/libexec/python/pyspark/java_gateway.py", line 31, in <module>
from py4j.java_gateway import java_import, JavaGateway, GatewayClient
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
File "/usr/local/Cellar/apache-spark/2.1.0/libexec/python/lib/py4j-0.10.4-src.zip/py4j/java_gateway.py", line 18, in <module>
File "/Users/hellmaster/anaconda/lib/python3.6/pydoc.py", line 62, in <module>
import pkgutil
File "/Users/hellmaster/anaconda/lib/python3.6/pkgutil.py", line 22, in <module>
ModuleInfo = namedtuple('ModuleInfo', 'module_finder name ispkg')
File "/usr/local/Cellar/apache-spark/2.1.0/libexec/python/pyspark/serializers.py", line 393, in namedtuple
cls = _old_namedtuple(*args, **kwargs)
TypeError: namedtuple() missing 3 required keyword-only arguments: 'verbose', 'rename', and 'module'
How do I fix this issue?
This is because Spark 2.1.0 is incompatible with Python 3.6.
See also this question.