RuntimeWarning while importing scipy.stats - scipy

While importing the scipy.stats I got following error, how to resolve this error
my versions are:
'3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)]'
Anaconda version: 2019.03 Build: py37_0
import scipy.stats as stats
Traceback (most recent call last):
File "<ipython-input-2-7e938f6e949f>", line 1, in <module>
import scipy.stats as stats
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\stats\__init__.py", line 367, in <module>
from .stats import *
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\stats\stats.py", line 172, in <module>
import scipy.special as special
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\special\__init__.py", line 641, in <module>
from ._ufuncs import *
File "__init__.pxd", line 918, in init scipy.special._ufuncs
RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility.
Expected 192 from C header, got 216 from PyObject

Related

ImportError: cannot import name 'QuantStub' from 'torch.ao.quantization'

ImportError: cannot import name 'QuantStub' from 'torch.ao.quantization'. I am calling functions from histocartography python package
/vol/ideadata/oc69ubiw/conda/pathoexplainer/lib/python3.10/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: /vol/ideadata/oc69ubiw/conda/pathoexplainer/lib/python3.10/site-packages/torchvision/image.so: undefined symbol: _ZN3c106detail19maybe_wrap_dim_slowEllb
warn(f"Failed to load image Python extension: {e}")
Traceback (most recent call last):
File "/vol/ideadata/oc69ubiw/Explainer_GNN/patho-quant-explainer/core/generate_cell_graphs.py", line 14, in <module>
from histocartography.preprocessing import (
File "/vol/ideadata/oc69ubiw/conda/pathoexplainer/lib/python3.10/site-packages/histocartography/preprocessing/__init__.py", line 2, in <module>
from .feature_extraction import HandcraftedFeatureExtractor
File "/vol/ideadata/oc69ubiw/conda/pathoexplainer/lib/python3.10/site-packages/histocartography/preprocessing/feature_extraction.py", line 13, in <module>
import torchvision
File "/vol/ideadata/oc69ubiw/conda/pathoexplainer/lib/python3.10/site-packages/torchvision/__init__.py", line 7, in <module>
from torchvision import models
File "/vol/ideadata/oc69ubiw/conda/pathoexplainer/lib/python3.10/site-packages/torchvision/models/__init__.py", line 18, in <module>
from . import quantization
File "/vol/ideadata/oc69ubiw/conda/pathoexplainer/lib/python3.10/site-packages/torchvision/models/quantization/__init__.py", line 3, in <module>
from .mobilenet import *
File "/vol/ideadata/oc69ubiw/conda/pathoexplainer/lib/python3.10/site-packages/torchvision/models/quantization/mobilenet.py", line 1, in <module>
from .mobilenetv2 import * # noqa: F401, F403
File "/vol/ideadata/oc69ubiw/conda/pathoexplainer/lib/python3.10/site-packages/torchvision/models/quantization/mobilenetv2.py", line 6, in <module>
from torch.ao.quantization import QuantStub, DeQuantStub
ImportError: cannot import name 'QuantStub' from 'torch.ao.quantization' (/vol/ideadata/oc69ubiw/conda/pathoexplainer/lib/python3.10/site-packages/torch/ao/quantization/__init__.py)
I had the same error. Reinstalling/Updating PyTorch fixed it. Seems to be supported by https://discuss.pytorch.org/t/cannot-import-name-quantstub-from-torch-ao-quantization/158979/2 . Jerry Zhang mentions that "...we are deprecating the torch.quantization namespace, and torch.ao.quantization is the recommended one".

AttributeError: module 'pyspark.sql.utils' has no attribute 'convert_exception'

Hi i have an issue with deltalake im trying to import
from delta import *
but i got the following error
anyone has any idea how to solve it please share it thanks in advance
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/dist-packages/delta/__init__.py", line 17, in <module>
from delta.tables import DeltaTable
File "/usr/local/lib/python3.7/dist-packages/delta/tables.py", line 17, in <module>
import delta.exceptions # noqa: F401; pylint: disable=unused-variable
File "/usr/local/lib/python3.7/dist-packages/delta/exceptions.py", line 152, in <module>
_patch_convert_exception()
File "/usr/local/lib/python3.7/dist-packages/delta/exceptions.py", line 140, in _patch_convert_exception
convert_sql_exception = utils.convert_exception
AttributeError: module 'pyspark.sql.utils' has no attribute 'convert_exception'
>>> from delta import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/dist-packages/delta/__init__.py", line 17, in <module>
from delta.tables import DeltaTable
File "/usr/local/lib/python3.7/dist-packages/delta/tables.py", line 17, in <module>
import delta.exceptions # noqa: F401; pylint: disable=unused-variable
File "/usr/local/lib/python3.7/dist-packages/delta/exceptions.py", line 152, in <module>
_patch_convert_exception()
File "/usr/local/lib/python3.7/dist-packages/delta/exceptions.py", line 140, in _patch_convert_exception
convert_sql_exception = utils.convert_exception
AttributeError: module 'pyspark.sql.utils' has no attribute 'convert_exception'
I had the same problem, I used the delta version 0.6.0 and work!!!
I had the same the issue in Glue jupyter notebook. Then I added following before I start the session:
%glue_version 3.0 %additional_python_modules graphframes==0.6
%extra_jars s3://s3-path/graphframes.jar,s3://s3-path/delta-core_2.12-1.0.0.jar
%extra_py_files s3://s3-path/graphframes.jar,s3://s3-path/delta-core_2.12-1.0.0.jar

Python errors with telnetlib

I have multiple errors with python's library telnetlib.
When I use it from the repl, here is the code I enter:
import telnetlib
telnetlib.Telnet("<an_ip>", <a_port>) as tn:
write("SYST:BEEP")
It retrurns the following error:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/usr/local/lib/python3.6/telnetlib.py", line 287, in write
if IAC in buffer:
TypeError: 'in <string>' requires string as left operand, not bytes
Now, something which is strange is when I execute the following script:
import telnetlib
def beep(tn):
"""Beep the pulse generator."""
tn.write("SYST:BEEP\n")
# Main for test purpose
if __name__ == "__main__":
with telnetlib.Telnet("<ip>", <port>) as tn:
beep(tn)
I have the following error and I have it each time I import telnetlib...
raceback (most recent call last):
File "test.py", line 1, in <module>
import telnetlib
File "/usr/lib/python3.7/telnetlib.py", line 37, in <module>
import socket
File "/usr/lib/python3.7/socket.py", line 53, in <module>
from enum import IntEnum, IntFlag
File "/usr/lib/python3.7/enum.py", line 2, in <module>
from types import MappingProxyType, DynamicClassAttribute
File "/home/vpecatte/dev/soft/soft/types.py", line 1, in <module>
from typing import *
File "/usr/lib/python3.7/typing.py", line 28, in <module>
import re as stdlib_re # Avoid confusion with the re we export.
File "/usr/lib/python3.7/re.py", line 143, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 53, in apport_excepthook
if not enabled():
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 24, in enabled
import re
File "/usr/lib/python3.7/re.py", line 122, in <module>
import enum
File "/usr/lib/python3.7/enum.py", line 2, in <module>
from types import MappingProxyType, DynamicClassAttribute
File "/home/vpecatte/dev/soft/soft/types.py", line 1, in <module>
from typing import *
File "/usr/lib/python3.7/typing.py", line 31, in <module>
from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType
ImportError: cannot import name 'WrapperDescriptorType' from 'types' (/home/vpecatte/dev/soft/soft/types.py)
Original exception was:
Traceback (most recent call last):
File "pulse_generator.py", line 1, in <module>
import telnetlib
File "/usr/lib/python3.7/telnetlib.py", line 37, in <module>
import socket
File "/usr/lib/python3.7/socket.py", line 53, in <module>
from enum import IntEnum, IntFlag
File "/usr/lib/python3.7/enum.py", line 2, in <module>
from types import MappingProxyType, DynamicClassAttribute
File "/home/vpecatte/dev/soft/soft/types.py", line 1, in <module>
from typing import *
File "/usr/lib/python3.7/typing.py", line 28, in <module>
import re as stdlib_re # Avoid confusion with the re we export.
File "/usr/lib/python3.7/re.py", line 143, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
I use python v3.7.5. I replaced correct informations by , .
Thank you for your help.
Looks like you have installed your own types module in /home/vpecatte/dev/soft/soft/types.py which conflicts with the Python built-in types module. The best solution is probably to rename that types module.

ModuleNotFoundError: No module named '_posixsubprocess' when creating virtual enviroment

i'm trying to set a virtual enviroment with:
$ python3 -m venv cv2
But when trying it, i'm getting this exception:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/usr/lib/python3.6/venv/__init__.py", line 10, in <module>
import subprocess
File "/usr/lib/python3.6/subprocess.py", line 136, in <module>
import _posixsubprocess
ModuleNotFoundError: No module named '_posixsubprocess'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 12, in <module>
import subprocess, tempfile, os.path, re, pwd, grp, os, time
File "/usr/lib/python3.6/subprocess.py", line 136, in <module>
import _posixsubprocess
ModuleNotFoundError: No module named '_posixsubprocess'
Original exception was:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/usr/lib/python3.6/venv/__init__.py", line 10, in <module>
import subprocess
File "/usr/lib/python3.6/subprocess.py", line 136, in <module>
import _posixsubprocess
ModuleNotFoundError: No module named '_posixsubprocess'
I've trying reinstalling subprocess32, but i haven't solved anything. I'm using Python 3.6.3 Anaconda on Ubuntu 18.04.1 LTS.
Any suggestions?

Run Theano on Python 3.5

Previously I have working installation of bleeding edge Theano version on Anaconda Python 2.7 x 64 on Windows 7 x64.
I tried to upgrade to bleeding edge Theano version on Python 3.5 x64 on Windows x64 and encountered error during test example compilation:
Problem occurred during compilation with the command line below:
C:\TDM-GCC-64\bin\g++.exe -shared -g -march=ivybridge -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mno-movbe -maes -mno-sha -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mavx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-clwb -mno-pcommit --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=ivybridge -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -IC:\Anaconda3\lib\site-packages\numpy\core\include -IC:\Anaconda3\include -IC:\Anaconda3\lib\site-packages\theano\gof -o C:\Users\s.nechuiviter\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_58_Stepping_9_GenuineIntel-3.5.1-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\s.nechuiviter\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_58_Stepping_9_GenuineIntel-3.5.1-64\lazylinker_ext\mod.cpp -LC:\Anaconda3\libs -LC:\Anaconda3 -lpython35
===============================
C:\Anaconda3\libs/python35.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 75, in <module>
raise ImportError()
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 92, in <module>
raise ImportError()
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/GIT_MIRROR/SRP_DLA/Python_DLA/tests/theano_test.py", line 4, in <module>
import theano.tensor as T
File "C:\Anaconda3\lib\site-packages\theano\__init__.py", line 64, in <module>
from theano.compile import (
File "C:\Anaconda3\lib\site-packages\theano\compile\__init__.py", line 10, in <module>
from theano.compile.function_module import *
File "C:\Anaconda3\lib\site-packages\theano\compile\function_module.py", line 22, in <module>
import theano.compile.mode
File "C:\Anaconda3\lib\site-packages\theano\compile\mode.py", line 12, in <module>
import theano.gof.vm
File "C:\Anaconda3\lib\site-packages\theano\gof\vm.py", line 646, in <module>
from . import lazylinker_c
File "C:\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 127, in <module>
preargs=args)
File "C:\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 2204, in compile_str
(status, compile_stderr.replace('\n', '. ')))
.
How to fix this?
It seems libpython conflicts with Python 3.5?