sklearn.utils module is not found - python

So I have sklearn installed, but for some reason whenever I try to import sklearn it says:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\joeya\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\sklearn\__init__.py", line 82, in <module>
from .base import clone
File "C:\Users\joeya\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\sklearn\base.py", line 17, in <module>
from .utils import _IS_32BIT
ModuleNotFoundError: No module named 'sklearn.utils'
Does anyone have any ideas? I have Python 3.8.7 installed.

Related

ModuleNotFoundError: No module named 'scipy.sparse'

Traceback (most recent call last):
File "C:\Users\Dell\.spyder-py3\SPYDER PROGRAMMING\temp.py", line 54, in <module>
from sklearn.feature_extraction.text import TfidfVectorizer
File "C:\Users\Dell\anaconda3\lib\site-packages\sklearn\__init__.py", line 82, in <module>
from .base import clone
File "C:\Users\Dell\anaconda3\lib\site-packages\sklearn\base.py", line 17, in <module>
from .utils import _IS_32BIT
File "C:\Users\Dell\anaconda3\lib\site-packages\sklearn\utils\__init__.py", line 20, in <module>
from scipy.sparse import issparse
ModuleNotFoundError: No module named 'scipy.sparse'
I have scipy in "conda list -n base" so i have no clue how to solve this

ModuleNotFoundError: No module named 'winreg'

I have been trying to use photoshop-python-api but I keep getting this error.
Traceback (most recent call last):
File "/Users/yash.sinha/PycharmProjects/PhotoshopPythonAPI/api.py", line 2, in <module>
import photoshop.api as ps
File "/Users/yash.sinha/PycharmProjects/PhotoshopPythonAPI/venv/lib/python3.8/site-packages/photoshop/__init__.py", line 1, in <module>
from photoshop.session import Session
File "/Users/yash.sinha/PycharmProjects/PhotoshopPythonAPI/venv/lib/python3.8/site-packages/photoshop/session.py", line 31, in <module>
from photoshop.api import (
File "/Users/yash.sinha/PycharmProjects/PhotoshopPythonAPI/venv/lib/python3.8/site-packages/photoshop/api/__init__.py", line 4, in <module>
from .action_descriptor import ActionDescriptor
File "/Users/yash.sinha/PycharmProjects/PhotoshopPythonAPI/venv/lib/python3.8/site-packages/photoshop/api/action_descriptor.py", line 12, in <module>
from ._core import Photoshop
File "/Users/yash.sinha/PycharmProjects/PhotoshopPythonAPI/venv/lib/python3.8/site-packages/photoshop/api/_core.py", line 6, in <module>
import winreg
ModuleNotFoundError: No module named 'winreg'
I did my research on winreg and I found out that it is a Windows Register. Am I getting this error because I am using a Mac? I have python 3.8.2 on my system.
Help.

Pyculib ImportError: cannot import name config

when trying to import pyculib I get ImportError: cannot import name config
I have tried pip installing and conda installing various versions of the cudatoolkit but none seem to work.
import pyculib
I get this error the first time I try to import pyculib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/andillio/anaconda2/lib/python2.7/site-packages/pyculib/__init__.py", line 49, in <module>
from . import blas, sparse, fft, rand, sorting
File "/home/andillio/anaconda2/lib/python2.7/site-packages/pyculib/sorting/__init__.py", line 1, in <module>
from .radixsort import RadixSort
File "/home/andillio/anaconda2/lib/python2.7/site-packages/pyculib/sorting/radixsort.py", line 38, in <module>
lib = load_lib('radixsort')
File "/home/andillio/anaconda2/lib/python2.7/site-packages/pyculib/sorting/common.py", line 24, in load_lib
libpath = os.path.join(findlib.get_lib_dir(), fullname)
AttributeError: 'module' object has no attribute 'get_lib_dir'
and this error if I try a second time
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named config

import matplotlib failed in Anaconda python3.6

I installed Anaconda to simplify the management of many python modules.
After that i tried to "import subprocess":
>>> import subprocess
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sej/.config/anaconda3/lib/python3.6/subprocess.py", line 155, in <module>
_PopenSelector = selectors.SelectSelector
AttributeError: module 'selectors' has no attribute 'SelectSelector'
How to fix this?
I came accross this problem by trying to use matplotlib.
When trying to import it, this error comes up:
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sej/.config/anaconda3/lib/python3.6/site-packages/matplotlib/__init__.py", line 127, in <module>
from matplotlib.compat import subprocess
File "/home/sej/.config/anaconda3/lib/python3.6/site-packages/matplotlib/compat/subprocess.py", line 27, in <module>
import subprocess
File "/home/sej/.config/anaconda3/lib/python3.6/subprocess.py", line 155, in <module>
_PopenSelector = selectors.SelectSelector
AttributeError: module 'selectors' has no attribute 'SelectSelector'

python-dbg can't find Py_InitModule4 when debugging

I'm trying to debug a segfault i get in a multithreaded, qt webkit application. I installed python-dbg for the purpose of giving me pretty printing in gdb and get the following error on start
python2.7-dbg node.py
Traceback (most recent call last):
File "node.py", line 4, in <module>
import msgpack
File "/usr/lib/pymodules/python2.7/msgpack/__init__.py", line 3, in <module>
from msgpack._msgpack import *
ImportError: /usr/lib/pymodules/python2.7/msgpack/_msgpack.so: undefined symbol: Py_InitModule4
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 64, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
from apport.report import Report
File "/usr/lib/python2.7/dist-packages/apport/report.py", line 20, in <module>
import apport.fileutils
File "/usr/lib/python2.7/dist-packages/apport/fileutils.py", line 22, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python2.7/dist-packages/apport/packaging_impl.py", line 20, in <module>
import apt
File "/usr/lib/python2.7/dist-packages/apt/__init__.py", line 21, in <module>
import apt_pkg
ImportError: /usr/lib/python2.7/dist-packages/apt_pkg.so: undefined symbol: Py_InitModule4
Original exception was:
Traceback (most recent call last):
File "node.py", line 4, in <module>
import msgpack
File "/usr/lib/pymodules/python2.7/msgpack/__init__.py", line 3, in <module>
from msgpack._msgpack import *
ImportError: /usr/lib/pymodules/python2.7/msgpack/_msgpack.so: undefined symbol: Py_InitModule4
I get the same thing when I run a version of the script that doesn't use msgpack...
Traceback (most recent call last):
File "scraper.py", line 2, in <module>
from planeswalker import PlaneswalkerParser
File "/var/www/rails_projects/MCPro.com/lib/planeswalker/planeswalker.py", line 2, in <module>
from PyQt4.QtCore import *
ImportError: /usr/lib/python2.7/dist-packages/PyQt4/QtCore.so: undefined symbol: Py_InitModule4
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 64, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
from apport.report import Report
File "/usr/lib/python2.7/dist-packages/apport/report.py", line 20, in <module>
import apport.fileutils
File "/usr/lib/python2.7/dist-packages/apport/fileutils.py", line 22, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python2.7/dist-packages/apport/packaging_impl.py", line 20, in <module>
import apt
File "/usr/lib/python2.7/dist-packages/apt/__init__.py", line 21, in <module>
import apt_pkg
ImportError: /usr/lib/python2.7/dist-packages/apt_pkg.so: undefined symbol: Py_InitModule4
Original exception was:
Traceback (most recent call last):
File "scraper.py", line 2, in <module>
from planeswalker import PlaneswalkerParser
File "/var/www/rails_projects/MCPro.com/lib/planeswalker/planeswalker.py", line 2, in <module>
from PyQt4.QtCore import *
ImportError: /usr/lib/python2.7/dist-packages/PyQt4/QtCore.so: undefined symbol: Py_InitModule4
in both cases its looking Py_InitModule4... any ideas python experts? Code runs fine (except for the segfault much later) with normal python 2.7
If there's an easier way to get pretty printing in gdb I'm open to that as well. Basically just looking for a python style stacktrace
after a bit of poking it looked like there were bugs related to this in past ubuntu python-dbg libraries. I filed a bug in suit and found out I just didn't read documentation. It is required to install the -dbg version of a library (MySQLdb and PyQT4 in this case)
There is no version for message pack so i'm posting another question on how to do that
here was the bug report marked invalid for reference https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1040914

Categories

Resources