Timedelta error; version 0.15.1-=np19py27_0 - pandas

This problem was asked at:
pandas Timedelta error
However, the solution (to get the latest version of pandas) did not work for me.
I've got the same problem (installed using anaconda, on Windows 7), and trying to do this gets the same problem.
Running from ipython:
In [1]: import pandas as pd
-----------------------------------------
ImportError
<ipython-input-1-af55e7023913> in <module
----> 1 import pandas as pd
C:\Anaconda\lib\site-packages\pandas\__in
45
46 # let init-time option registrati
---> 47 import pandas.core.config_init
48
49 from pandas.core.api import *
C:\Anaconda\lib\site-packages\pandas\core
15 i
16 g
---> 17 from pandas.core.format import de
18
19
C:\Anaconda\lib\site-packages\pandas\core
7 from pandas.core.base import Pand
8 from pandas.core.common import ad
----> 9 from pandas.core.index import Ind
10 from pandas import compat
11 from pandas.compat import(StringI
C:\Anaconda\lib\site-packages\pandas\core
13 import pandas.algos as _algos
14 import pandas.index as _index
---> 15 from pandas.lib import Timestamp,
16 from pandas.core.base import Pand
17 from pandas.util.decorators impor
ImportError: cannot import name Timedelta
I've checked the pandas version, it is 0.15.1-np19py27_0.
nosetests pandas also returns problems:
PS R:\data\python_testing\ipython_notebooks> nosetests pandas
E
======================================================================
ERROR: Failure: ImportError (cannot import name Timedelta)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\nose\loader.py", line 403, in loadTestsFromName
module = resolve_name(addr.module)
File "C:\Anaconda\lib\site-packages\nose\util.py", line 311, in resolve_name
module = __import__('.'.join(parts_copy))
File "C:\Anaconda\lib\site-packages\pandas\__init__.py", line 47, in <module>
import pandas.core.config_init
File "C:\Anaconda\lib\site-packages\pandas\core\config_init.py", line 17, in <module>
from pandas.core.format import detect_console_encoding
File "C:\Anaconda\lib\site-packages\pandas\core\format.py", line 9, in <module>
from pandas.core.index import Index, MultiIndex, _ensure_index
File "C:\Anaconda\lib\site-packages\pandas\core\index.py", line 15, in <module>
from pandas.lib import Timestamp, Timedelta, is_datetime_array
ImportError: cannot import name Timedelta
----------------------------------------------------------------------
Ran 1 test in 0.000s
FAILED (errors=1)
This issue is discussed at github:
https://github.com/pydata/pandas/issues/8862

I had this problem recently, and it turned out to be because I had recently used conda to install some packages from the command prompt, but had forgetten to launch the command prompt as administrator.
In my case I was able to fix the problem by launching command prompt as administrator, and reinstalling the packages concerned with "conda install -f ".
In your case you could try "conda install -f pandas".
It is possible you might have this problem with more than one package.

i'm pretty sure this issue occurs on Windows due to file open issues. Because a process is holding the file handler to one of the packages files the upgrade fails. Kill all Python and Excel processes and try again.

Related

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 44 from C header, got 40 from PyObject

I'm trying to run python code that uses the pandas library on the BeagleBone Black. I have all the necessary libraries and packages downloaded onto the device. When I try to run the code, I get an error regarding the numpy.ndarray size being changed. Currently, I am using Python 3.7.3, numpy 1.20.1, and pandas 1.3.5.
When I try to my python file, an error occurs with importing the pandas library. The traceback of the error I'm encountering is included below. I have tried the following to resolve this issue:
pip install --upgrade numpy
and
pip uninstall numpy
pip install numpy
as suggested here.
Traceback
root#beaglebone:/mnt/microSD# python chunkANDconvert.py
Traceback (most recent call last):
File "chunkANDconvert.py", line 2, in <module>
import pandas as pd
File "/usr/local/lib/python3.7/dist-packages/pandas/__init__.py", line 22, in <module>
from pandas.compat import (
File "/usr/local/lib/python3.7/dist-packages/pandas/compat/__init__.py", line 15, in <module>
from pandas.compat.numpy import (
File "/usr/local/lib/python3.7/dist-packages/pandas/compat/numpy/__init__.py", line 7, in <module>
from pandas.util.version import Version
File "/usr/local/lib/python3.7/dist-packages/pandas/util/__init__.py", line 1, in <module>
from pandas.util._decorators import ( # noqa
File "/usr/local/lib/python3.7/dist-packages/pandas/util/_decorators.py", line 14, in <module>
from pandas._libs.properties import cache_readonly # noqa
File "/usr/local/lib/python3.7/dist-packages/pandas/_libs/__init__.py", line 13, in <module>
from pandas._libs.interval import Interval
File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 44 from C header, got 40 from PyObject

ImportError: cannot import name 'animation' from partially initialized module 'matplotlib'

I'm facing the following erro:
ImportError Traceback (most recent call last)
<ipython-input-1-0484cd13f94d> in <module>
----> 1 import matplotlib
~\Anaconda3\lib\site-packages\matplotlib\__init__.py in <module>
105 # cbook must import matplotlib only within function
106 # definitions, so it is safe to import from it here.
--> 107 from . import cbook, rcsetup
108 from matplotlib.cbook import MatplotlibDeprecationWarning, sanitize_sequence
109 from matplotlib.cbook import mplDeprecation # deprecated
~\Anaconda3\lib\site-packages\matplotlib\rcsetup.py in <module>
24 import numpy as np
25
---> 26 from matplotlib import animation, cbook
27 from matplotlib.cbook import ls_mapper
28 from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
ImportError: cannot import name 'animation' from partially initialized module 'matplotlib'
I've removed matplotlib and then reinstalled it. I've also tried to use pip install matplotlib --force-reinstall --user command, but the error persists. The most curious is that matplotlib runs properly when I run Python in Windows Prompt Command, but not in Jupyter or Spider. I cant use admin privileges. Im running python 3.8.5 and matplotlib 3.4.2.

Dropbox ModuleNotFoundError: No module named 'stone'

Im trying to import Dropbox with the line:
import dropbox
on Google Colab but im getting the following error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-26-fac67f6fa745> in <module>()
28 import math
29 import io
---> 30 import dropbox
31 from keras.models import Sequential
32 from keras.layers import Dense
2 frames
/usr/local/lib/python3.6/dist-packages/dropbox/auth.py in <module>()
5 # pylint: skip-file
6 from __future__ import unicode_literals
----> 7 from stone.backends.python_rsrc import stone_base as bb
8 from stone.backends.python_rsrc import stone_validators as bv
9
ModuleNotFoundError: No module named 'stone'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
It was working perfectly normal a day ago
The problem is that a new release of Dropbox API was out today and it has that glitch. Just used the version before today by using
pip install dropbox==10.10.0

pip install PyRQA in Google colab

Hope someone can help me, when I try to install and run PyRQA in colab in the GPU runtime and after run the next code:
pip install PyRQA
from pyrqa.time_series import TimeSeries
from pyrqa.settings import Settings
from pyrqa.analysis_type import Classic
from pyrqa.neighbourhood import FixedRadius
from pyrqa.metric import EuclideanMetric
from pyrqa.computation import RQAComputation
from pyrqa.computation import RPComputation
from pyrqa.image_generator import ImageGenerator
give me the next error.
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-6c56a517e983> in <module>()
4 from pyrqa.neighbourhood import FixedRadius
5 from pyrqa.metric import EuclideanMetric
----> 6 from pyrqa.computation import RQAComputation
7 from pyrqa.computation import RPComputation
8 from pyrqa.image_generator import ImageGenerator
6 frames
/usr/local/lib/python3.6/dist-packages/pyopencl/tools.py in <module>()
35 from decorator import decorator
36 from pytools import memoize, memoize_method
---> 37 from pyopencl._cl import bitlog2 # noqa: F401
38 from pytools.persistent_dict import KeyBuilder as KeyBuilderBase
39
ImportError: /usr/lib64-nvidia/libOpenCL.so.1: version `OPENCL_2.1' not found (required by /usr/local/lib/python3.6/dist-packages/pyopencl/_cl.cpython-36m-x86_64-linux-gnu.so)
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
Some days ago it works fine, but after yesterday it doesn't work anymore

ImportError: No module named 'twisted.persisted'

I haved install scrapy on Python 3.5.2, but when I exeute scrapy -v on command-line, it occurs:
>> scrapy -v
Traceback (most recent call last):
File "/usr/bin/scrapy", line 7, in <module>
from scrapy.cmdline import execute
File "/usr/local/python3.5.2/lib/python3.5/site-packages/scrapy/__init__.py", line 27, in <module>
from . import _monkeypatches
File "/usr/local/python3.5.2/lib/python3.5/site-packages/scrapy/_monkeypatches.py", line 20, in <module>
import twisted.persisted.styles # NOQA
ImportError: No module named 'twisted.persisted'
So I enter ipython3 to ensure whether it's installed porperly:
In [2]: import twisted
In [3]: twisted.version
Out[3]: Version('twisted', 15, 2, 1)
But when I import scrapy, the same as command-line:
In [4]: import scrapy
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-4-51c73a18167b> in <module>()
----> 1 import scrapy
/usr/local/python3.5.2/lib/python3.5/site-packages/scrapy/__init__.py in <module>()
25
26 # Apply monkey patches to fix issues in external libraries
---> 27 from . import _monkeypatches
28 del _monkeypatches
29
/usr/local/python3.5.2/lib/python3.5/site-packages/scrapy/_monkeypatches.py in <module>()
18 # Undo what Twisted's perspective broker adds to pickle register
19 # to prevent bugs like Twisted#7989 while serializing requests
---> 20 import twisted.persisted.styles # NOQA
21 # Remove only entries with twisted serializers for non-twisted types.
22 for k, v in frozenset(copyreg.dispatch_table.items()):
ImportError: No module named 'twisted.persisted'
I'm so confused, I just want to run a spaider, So help me !
Your Twisted version is outdated, if you look at requirements-py3.txt file:
Twisted >= 15.5.0
lxml>=3.2.4
pyOpenSSL>=0.13.1
cssselect>=0.9
queuelib>=1.1.1
w3lib>=1.17.0
service_identity
Where your's is, 15.2.
Currently the latest version 17.1.0 and there are no downsides of running it; Try:
pip3 install twisted --upgrade