Python AccesControl AttributeError: 'module' object has no attribute 'CAPI2' - python

I am receiving the following error when trying to import AccessControl.
C:\windows\system32>python
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import AccessControl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\AccessControl\__init__.py", line 16, in <module>
from AccessControl.Implementation import setImplementation
File "C:\Python27\lib\site-packages\AccessControl\Implementation.py", line 96, in <module>
setImplementation("C")
File "C:\Python27\lib\site-packages\AccessControl\Implementation.py", line 51, in setImplementation
from AccessControl import ImplC as impl
File "C:\Python27\lib\site-packages\AccessControl\ImplC.py", line 17, in <module>
from AccessControl.cAccessControl import rolesForPermissionOn
AttributeError: 'module' object has no attribute 'CAPI2'
I have tried to reinstalling the library but the problem remains the same.
The only thing I found while searching the error is this page but I did not understand the solution.

Solved this by reinstalling python and all the libraries.

Related

ImportError: cannot import name '_has_torch_function' from 'torch._C'

When I import torch, I get the following error:
I dont know if it has something to do with the fact i just install cuda11.6.
I tried to unintalled and install pytorch , it didn't work.
Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:21)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/zengyunzi1/.conda/envs/yz/lib/python3.7/site-packages/torch/__init__.py", line 603, in <module>
from ._tensor import Tensor
File "/home/zengyunzi1/.conda/envs/yz/lib/python3.7/site-packages/torch/_tensor.py", line 15, in <module>
from torch.overrides import (
File "/home/zengyunzi1/.conda/envs/yz/lib/python3.7/site-packages/torch/overrides.py", line 33, in <module>
from torch._C import (
ImportError: cannot import name '_has_torch_function' from 'torch._C' (/home/zengyunzi1/.conda/envs/yz/lib/python3.7/site-packages/torch/_C.cpython-37m-x86_64-linux-gnu.so)
>>>

ImportError: No module named parse even after installing dataset and parse

I get the following error. I also installed PIP Parse and dataset using PIP install
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import dataset
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27amd64\lib\site-packages\dataset\__init__.py", line 3, in <module>
from dataset.database import Database
File "C:\Python27amd64\lib\site-packages\dataset\database.py", line 3, in <module>
from urllib.parse import parse_qs, urlparse
ImportError: No module named parse

Cannot import python module pyo

I'm trying to import pyo for this project I'm working on but this is the output I get when I try to do so:
Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\spark\AppData\Roaming\Python\Python37\site-packages\pyo\__init__.py", line 28, in <module>
from .lib import analysis as analysis
File "C:\Users\spark\AppData\Roaming\Python\Python37\site-packages\pyo\lib\analysis.py", line 32, in <module>
from ._core import *
File "C:\Users\spark\AppData\Roaming\Python\Python37\site-packages\pyo\lib\_core.py", line 58, in <module>
from .._pyo import *
ImportError: DLL load failed: The specified module could not be found.
I've tried uninstalling and downgrading pyo but I can't seem to get it to import. Can anyone help me out?

Python 3: No module named 'AudioSignal'

The code below gives this error when I'm trying to execute it:
>>> import nussl
>>> history = nussl.AudioSignal('HistoryRepeatingPropellerHeads.wav')
Error is:
C:\Users\MyPCUser>python
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import nussl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\MyPCUser\AppData\Local\Programs\Python\Python37\lib\site-packages\nussl\__init__.py", line 26, in <modul
e>
from .core.constants import *
File "C:\Users\MyPCUser\AppData\Local\Programs\Python\Python37\lib\site-packages\nussl\core\__init__.py", line 7, in <m
odule>
from audio_signal import AudioSignal
ModuleNotFoundError: No module named 'audio_signal'
>>>
This module does not work yet (23-Feb-2019) with Python 3 according to Issue 135 and Issue 133. From the docs: This package has been tested with python 2.7, but not python 3.x yet. Use python 3 at your own peril!
I got the same issue when trying to use it with Python 3.

Python Import Error when importing tests from django-social-auth

I'm trying to subclass some classes from the django-social-auth package to create custom test.
The source https://github.com/omab/django-social-auth
The problem is that i cannot import the "tests" part:
C:\Users\Alle>python
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import social_auth.tests.base
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named tests.base
>>> import social_auth.tests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named tests
>>> import social_auth.db
>>> social_auth.db
<module 'social_auth.db' from 'C:\Python26\lib\site-packages\social_auth\db\__init__.pyc'>
>>>
why i get this behaviour?
Tests aren't installed by default
from social_auth setup.py
packages=['social_auth',
'social_auth.management',
'social_auth.management.commands',
'social_auth.backends',
'social_auth.backends.contrib',
'social_auth.backends.pipeline',
'social_auth.migrations',
'social_auth.db'],

Categories