Modin read_csv issue - pandas

I'm attempting to read a csv file using modin and it results in the following error. this issue seems to happen on all dataframe operations:
RayWorkerError: The worker died unexpectedly while executing this
task.
Python 3.7.3
Pandas 0.24.2
Modin 0.5.4
Ray 0.7.1
import modin.pandas as pd
import numpy as np
frame_data = np.random.randint(0, 100, size=(2**10, 2**8))
pd.DataFrame(frame_data).to_csv('frame_data.csv')
pd.read_csv('frame_data.csv').head()

OP confirmed that the reason for the failure was the presence of the typing package, and that uninstalling typing fished the issue. That was a temporary fix for the issue tracked on Ray here. That issue was closed once Modin fixed the order of imports for the typing library. The latest version of Modin (0.12.0) should not have that problem.

Related

"no module named numpy.core" error after installing numpy in a layer in AWS Lambda

When I deployed my serverless FastAPI with AWS Lambda and API Gateway I got the following error:
No module named numpy.core. Unable to import module 'path/to/handler': Unable to import required dependencies: numpy
And I also got this:
The python version is: Python3.7 from "var/lang/bin/python3.7" , the numpy version is: "1.21.6"
I have installed the numpy module in a layer and included the path to the directory where the module is installed in the serverless.yml file and I still experience the "no module named numpy.core" error.
My serverless.yml file looks like this:
layers:
something:
compatibleRuntimes:
- python3.8
- python3.7
- python3.6
path: 'path/to/layer'
I also tried without the compatibleRuntimes block, and I still got the same error.
I think that since the numpy module is installed and the correct version is being used, it is likely that the issue is not related to the numpy module itself.
And, actually, in my code, what I import is the pandas module, but when I install pandas, it also installs numpy.
import pandas as pd
# functions
Any advice or tip? I have been stuck in this for a long time. Thank you in advance!

Error on Scope Variable While Using Tensorflow Hub

I am using Colab to run a text analysis code. I am want to get universal-sentence-encoder-large from tensorflow_hub.
But anytime running the block containing the code below:
module = hub.Module("https://tfhub.dev/google/universal-sentence-encoder-large/3")
I get this error:
RuntimeError: variable_scope module_8/ was unused but the
corresponding name_scope was already taken.
I appreciate if you have any idea how this error can be fixed?
TF Hub USE-3 Module doesn't work with Tensorflow Version 2.0.
Hence, if you change the version from 2.0 to 1.15, it works without any error.
Please find the working code mentioned below:
!pip install tensorflow==1.15
!pip install "tensorflow_hub>=0.6.0"
!pip3 install tensorflow_text==1.15
import tensorflow as tf
import tensorflow_hub as hub
import numpy as np
import tensorflow_text
module = hub.Module("https://tfhub.dev/google/universal-sentence-encoder-large/3")
Please find the Github Gist of Google Colab as well.
With tensorflow 2 in google colab you should use hub.load(url) instead of hub.Module(url)

ModuleNotFoundError: No module named 'pandas.io' for json_normalize

Please read carefully. In my Python script I have the following:
import json
import pandas
from pandas.io.json import json_normalize
and it returns the following error:
from pandas.io.json import json_normalize ModuleNotFoundError: No
module named 'pandas.io'; 'pandas' is not a package
My steps:
I have uninstalled and installed Pandas
I have upgraded pip and pandas
I have installed io (pip install -U pandas.io)
I have installed data_reader and replaced the pandas.io.json part with that: from pandas_datareader import json_normalize
I have tried every solution I saw on stackoverflow and github and nothing worked. The only one I have not tried is installing Anaconda but it should work with what I tried before. Do you think it is a Windows setting things I must change?
PS: My Python version is 3.7.4
Try:
Go to ...\Lib\site-packages\pytrends on your local disk and open file request.py
Change
from pandas.io.json._normalize import nested_to_record
to
from pandas.io.json.normalize import nested_to_record
I had the same error, but it helped me.
also change
from pandas.io.json.normalize
to
from pandas.io.json._normalize
The cause of the problem was the fact that the python file had the name pandas. The filename was pandas.py. After renaming it, the code worked normally without errors.
i had same problem and i solve it b uninstalling extra python versions install on my windows.now i have only one python installed by anaconda,and everything is working perfectly

Enthought Canopy Pandas not installing

Using Enthought Canopy; the following command import pandas produces this error message:
ImportError: C extension: hashtable not built. If you want to import pandas
from the source directory, you may need to run 'python setup.py build_ext --
inplace' to build the C extensions first.
Which I understand means that the package hasn't been built with it's C dependencies? I thought Canopy's environment handled module installations, I have tried removing, and updating Pandas with no luck.
Does anyone know how to correctly use Pandas in Enthought Canopy?
Forcing a reinstallation of Pandas and its dependencies with enpkg pandas --forceall run from a Canopy Terminal/Command Prompt seems to have fixed the problem.

wx script can't see numpy, but it's installed

I had a wx script working on winxp (at work). it was upgraded to win7_64. I installed python2 and wxpython (both 32bit). now my script doesn't want to run. it says "ImportError: NumPy not found.". so I installed numpy from numpy.org, but it didnt change anything. I can import wx, I can import numpy, but when I try to run my wx script, it says that numpy is not installed. I removed and reinstalled everything but nothing changed.
what to do?
Presumably your numpy is too "new" or your wxPython is too old.
For example the combination wxPython < 3.0 and numpy > 1.9 will not work for the plot module (2.9.5 + numpy 1.8.0 and 3.0.2 + numpy 1.9.2 do actually work).
Reason should be file <site-packages.wx>/lib/plot.py (2.9.5):
# Needs NumPy
try:
import numpy.oldnumeric as _Numeric
except:
msg= """
This module requires the NumPy module, which could not be
imported. It probably is not installed (it's not part of the
standard Python distribution). See the Numeric Python site
(http://numpy.scipy.org) for information on downloading source or
binaries."""
raise ImportError, "NumPy not found.\n" + msg
and as used in 3.0.2):
# Needs NumPy
try:
import numpy as np
except:
numpy.oldnumeric is no longer part of numpy 1.9.2, wx.lib.plot was developed for ancient array libraries and you can clearly see its age.