Pandas Import : ModuleNotFoundError: No module named 'pandas.api.extensions' - import

I wanted to import geopandas as gpd, but the error message appears
ModuleNotFoundError: No module named 'pandas.api.extensions'.
What I have to do, to import geopandas?
I installed geopandas via anaconda promt:
C:\Users\sar>conda install -c conda-forge geopandas
Collecting package metadata (current_repodata.json): done
Solving environment: done
All requested packages already installed.
When i import geopandas, following code is shown in the console:
import geopandas as gpd
Traceback (most recent call last):
File "<ipython-input-16-a62d01c1d62e>", line 1, in <module>
import geopandas as gpd
File "C:\Users\sar\Anaconda\envs\codingingis\lib\site-packages\geopandas\__init__.py", line 1, in <module>
from geopandas.geoseries import GeoSeries # noqa
File "C:\Users\sar\Anaconda\envs\codingingis\lib\site-packages\geopandas\geoseries.py", line 15, in <module>
from geopandas.base import GeoPandasBase, _delegate_property
File "C:\Users\sar\Anaconda\envs\codingingis\lib\site-packages\geopandas\base.py", line 13, in <module>
from .array import GeometryArray, GeometryDtype
File "C:\Users\sar\Anaconda\envs\codingingis\lib\site-packages\geopandas\array.py", line 7, in <module>
from pandas.api.extensions import ExtensionArray, ExtensionDtype
ModuleNotFoundError: No module named 'pandas.api.extensions'
in array.py this code is not found:
from pandas.api.extensions import ExtensionArray, ExtensionDtype

Related

I run odoo 15 on vs-code but these errors appear what the solution for these?

The errors is:
( /usr/bin/env /bin/python3 /home/abdulrahman/.vscode/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 37511 -- /home/abdulrahman/odoo/odoo-15.0/odoo-bin --config=/home/a /usr/bin/env /bin/python3 /home/abdulrahman/.vscode/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 37511 -- /home/abdulrahman/odoo/odoo-15.0/odoo-bin --config=/home/abdulrahman/odoo/config/odoo15.conf
Traceback (most recent call last):
File "/home/abdulrahman/odoo/odoo-15.0/odoo-bin", line 5, in
import odoo
File "/home/abdulrahman/odoo/odoo-15.0/odoo/init.py", line 113, in
from . import modules
File "/home/abdulrahman/odoo/odoo-15.0/odoo/modules/init.py", line 8, in
from . import db, graph, loading, migration, module, registry
File "/home/abdulrahman/odoo/odoo-15.0/odoo/modules/graph.py", line 10, in
import odoo.tools as tools
File "/home/abdulrahman/odoo/odoo-15.0/odoo/tools/init.py", line 8, in
from . import pdf
File "/home/abdulrahman/odoo/odoo-15.0/odoo/tools/pdf.py", line 18, in
from odoo.tools.misc import file_open
File "/home/abdulrahman/odoo/odoo-15.0/odoo/tools/misc.py", line 35, in
import babel
File "/home/abdulrahman/.local/lib/python3.10/site-packages/babel/init.py", line 20, in
from babel.core import UnknownLocaleError, Locale, default_locale, \
File "/home/abdulrahman/.local/lib/python3.10/site-packages/babel/core.py", line 14, in
from babel import localedata
File "/home/abdulrahman/.local/lib/python3.10/site-packages/babel/localedata.py", line 17, in
from collections import MutableMapping
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.10/collections/init.py)bdulrahman/odoo/config/odoo15.conf
Traceback (most recent call last):
File "/home/abdulrahman/odoo/odoo-15.0/odoo-bin", line 5, in
import odoo
File "/home/abdulrahman/odoo/odoo-15.0/odoo/init.py", line 113, in
from . import modules
File "/home/abdulrahman/odoo/odoo-15.0/odoo/modules/init.py", line 8, in
from . import db, graph, loading, migration, module, registry
File "/home/abdulrahman/odoo/odoo-15.0/odoo/modules/graph.py", line 10, in
import odoo.tools as tools
File "/home/abdulrahman/odoo/odoo-15.0/odoo/tools/init.py", line 8, in
from . import pdf
File "/home/abdulrahman/odoo/odoo-15.0/odoo/tools/pdf.py", line 18, in
from odoo.tools.misc import file_open
File "/home/abdulrahman/odoo/odoo-15.0/odoo/tools/misc.py", line 35, in
import babel
File "/home/abdulrahman/.local/lib/python3.10/site-packages/babel/init.py", line 20, in
from babel.core import UnknownLocaleError, Locale, default_locale, \
File "/home/abdulrahman/.local/lib/python3.10/site-packages/babel/core.py", line 14, in
from babel import localedata
File "/home/abdulrahman/.local/lib/python3.10/site-packages/babel/localedata.py", line 17, in
from collections import MutableMapping
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.10/collections/init.py))
This is the errors i want the solutions for it.
Hi I'm not sure if it's the proper solution but I experienced some difficulty with my python version and when I downgraded the version (to py3.9) it worked. You can Try it too. Also I suggest to check your launch.json configurations and make sure that all the paths and names have been set correctly.

Import Error : cannot import name 'linlag' from 'scipy'

Uninstalled & reinstalled scipy package, though cannot seem to import linalg function.
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-133368b721e2> in <module>
1 import numpy as np
2 import sklearn
----> 3 from scipy import linlag
ImportError: cannot import name 'linlag' from 'scipy' (C:\Users\lenov\anaconda3\lib\site-packages\scipy\__init__.py)
It's a minor syntax error. It should be "linalg".

Can't import scipy

My issue is about the import of scipy
Reproducing code example:
import scipy
Error message:
Traceback (most recent call last):
File "D:/Projects/gait/tests/__init__.py", line 2, in <module>
import scipy
File "C:\Users\Leynier\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\__init__.py", line 110, in <module>
from scipy._lib._version import NumpyVersion as _NumpyVersion
File "C:\Users\Leynier\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\_lib\__init__.py", line 14, in <module>
from scipy._lib._testutils import PytestTester
ValueError: source code string cannot contain null bytes
Process finished with exit code 1
Scipy/Numpy/Python version information:
Scipy version: 1.3.0
Numpy version: 1.16.4
Python version: 3.7.3
OS: Windows 10

Import Error of IBM Watson Natural Language Understanding API

I am now trying to extract keywords by using IBM Watson Natural Language Understanding API. I follow the instruction and have installed the watson_developer_cloud. However, I met an error when import the NaturalLanguageUnderstandingV1. Could you help me with it? Thank you!
from watson_developer_cloud import NaturalLanguageUnderstandingV1
Traceback (most recent call last):
File "<ipython-input-11-ab5aa6f014f4>", line 1, in <module>
from watson_developer_cloud import NaturalLanguageUnderstandingV1
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-
packages\watson_developer_cloud\__init__.py", line 30, in <module>
rom .speech_to_text_v1 import SpeechToTextV1
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-
packages\watson_developer_cloud\speech_to_text_v1.py", line 74, in <module>
from watson_developer_cloud.websocket import RecognizeCallback, RecognizeListener
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\watson_developer_cloud\websocket\__init__.py", line 18, in <module>
from .speech_to_text_websocket_listener import RecognizeListener
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\watson_developer_cloud\websocket\speech_to_text_websocket_listener.py", line 21, in <module>
from twisted.internet import ssl, reactor
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\twisted\internet\ssl.py", line 59, in <module>
from OpenSSL import SSL
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\OpenSSL\crypto.py", line 16, in <module>
from OpenSSL._util import (
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\OpenSSL\_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 13, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: DLL load failed: The operating system cannot run %1.
After reinstalling the watson-cloud-developer as an administrator. I solve the problem. It seems that if we do not run the pip install command as an administrator, then the package cannot be installed correctly.

Docker-compose ps error

I am new to docker-compose and getting the following error when I type in docker-compose ps.
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 7, in <module>
from compose.cli.main import main
File "/Library/Python/2.7/site-packages/compose/cli/main.py", line 20, in <module>
from ..bundle import get_image_digests
File "/Library/Python/2.7/site-packages/compose/bundle.py", line 14, in <module>
from .service import format_environment
File "/Library/Python/2.7/site-packages/compose/service.py", line 37, in <module>
from .parallel import parallel_execute
File "/Library/Python/2.7/site-packages/compose/parallel.py", line 10, in <module>
from six.moves import _thread as thread
ImportError: cannot import name _thread
Docker-compose is written by python. It seems that you miss some python packages. You can refer to the following page of how to fix the python lib issue.
Matplotlib issue on OS X ("ImportError: cannot import name _thread")
Alternatively, you can try to install docker-compose as a container, the docker container contains appropriate environment for docker-compose.
https://docs.docker.com/compose/install/#install-as-a-container