[Tutor] ImportError

Tannu Dekeza tannu.dekeza at gmail.com
Sun Nov 12 04:45:43 EST 2023


Hi

*I'm a beginner at python programming. I have been trying to execute
the below code and have been getting an import error for numpy. i am
using jupyter notebook. i have reinstalled both python and jupyter
notebook but the error always occurs when i restart a kernel. how can
i solve this permanently *



import numpy as np
import pandas as pd
import math
import xlsxwriter
import requests



ImportError                               Traceback (most recent call last)
Cell In[1], line 1----> 1 import numpy as np      2 import pandas as
pd      3 import math

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\numpy\__init__.py:171
   169 from . import fft    170 from . import polynomial--> 171 from .
import random    172 from . import ctypeslib    173 from . import ma

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\numpy\random\__init__.py:180
   126 __all__ = [    127     'beta',    128     'binomial',   (...)
 176     'zipf',    177 ]    179 # add these for module-freeze
analysis (like PyInstaller)--> 180 from . import _pickle    181 from .
import _common    182 from . import _bounded_integers

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\numpy\random\_pickle.py:1---->
1 from .mtrand import RandomState      2 from ._philox import Philox
   3 from ._pcg64 import PCG64, PCG64DXSM

File numpy\\random\\mtrand.pyx:1, in init numpy.random.mtrand()

File bit_generator.pyx:40, in init numpy.random.bit_generator()
ImportError: cannot import name randbits


More information about the Tutor mailing list