importing dask_cuda results in parse_memory_limit error - python

I'm trying to import dask_cuda as the examples:
from dask_cuda import LocalCUDACluster
from dask.distributed import Client
But I receive the following error:
ImportError Traceback (most recent call last)
Input In [3], in <cell line: 1>()
----> 1 from dask_cuda import LocalCUDACluster
File ~/miniconda3/lib/python3.8/site-packages/dask_cuda/__init__.py:5, in <module>
2 import dask.dataframe.shuffle
4 from ._version import get_versions
----> 5 from .cuda_worker import CUDAWorker
6 from .explicit_comms.dataframe.shuffle import get_rearrange_by_column_tasks_wrapper
7 from .local_cuda_cluster import LocalCUDACluster
File ~/miniconda3/lib/python3.8/site-packages/dask_cuda/cuda_worker.py:19, in <module>
14 from distributed.proctitle import (
15 enable_proctitle_on_children,
16 enable_proctitle_on_current,
17 )
18 from distributed.utils import parse_bytes
---> 19 from distributed.worker import parse_memory_limit
21 from .device_host_file import DeviceHostFile
22 from .initialize import initialize
ImportError: cannot import name 'parse_memory_limit' from 'distributed.worker' (/home/shambakey1/miniconda3/lib/python3.8/site-packages/distributed/worker.py)
I googled this error, but couldn't find anything related to it. I thought it was a DASK problem, so I re-tried with only from dask.distributed import Client, and it worked. So, I guess this error is related to dask_cuda, but I don't know how.
The version I have are:
dask-cuda -> 22.6.0
dask -> 2021.12.0
distributed -> 2021.12.0
Ubuntu 20.04
Regards

Your dask version is rather old, the parse_memory_limit was added fairly recently in 2022, see this PR.
I would recommend not pinning dask and let conda find the most suitable version. If that's not an option, then dask=2022.7.0 works for me with dask-cuda=2022.6.0.

Related

Problem with 'cdqa': cannot import name 'TemporaryResourcesManager' from 'joblib._memmapping_reducer'

I am trying to use the cdqa library (https://github.com/cdqa-suite/cdQA). I cloned the GitHub repository using "git clone" and changed the specified versions of pandas and pytorch in the "requirements.txt" file for my versions (because I had problems installing the specific versions requested for these two libraries and, according to the "issues" in that github repository, several people managed to install cdqa by changing the versions in "requirements.txt"). Then, I used:
cd cdQA
pip install -e .
Now, I'm running the example that is in that library's GitHub repository:
import pandas as pd
from ast import literal_eval
from cdqa.utils.filters import filter_paragraphs
from cdqa.utils.download import download_model, download_bnpp_data
from cdqa.pipeline.cdqa_sklearn import QAPipeline
#from cdqa.pipeline import QAPipeline
# Download data and models
download_bnpp_data(dir='./data')
download_model(model='bert-squad_1.1', dir='./Models')
# Loading data and filtering / preprocessing the documents
df = pd.read_csv('data/bnpp_newsroom-v1.1.csv', converters={'paragraphs': literal_eval})
df = filter_paragraphs(df)
# Loading QAPipeline with CPU version of BERT Reader pretrained on SQuAD 1.1
cdqa_pipeline = QAPipeline(reader='Models/bert_qa.joblib')
but it returns the following error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-29-596fa5ffc73b> in <module>
4 from cdqa.utils.filters import filter_paragraphs
5 from cdqa.utils.download import download_model, download_bnpp_data
----> 6 from cdqa.pipeline.cdqa_sklearn import QAPipeline
7 #from cdqa.pipeline import QAPipeline
8
~/Documents/GIT/QA/cdQA/cdqa/pipeline/__init__.py in <module>
----> 1 from .cdqa_sklearn import QAPipeline
2
3 __all__ = ["QAPipeline"]
~/Documentos/Morning_Star_Consulting/GIT/QA/cdQA/cdqa/pipeline/cdqa_sklearn.py in <module>
----> 1 import joblib
2 import warnings
3
4 import pandas as pd
5 import numpy as np
~/anaconda3/lib/python3.8/site-packages/joblib/__init__.py in <module>
118 from .numpy_pickle import load
119 from .compressor import register_compressor
--> 120 from .parallel import Parallel
121 from .parallel import delayed
122 from .parallel import cpu_count
~/anaconda3/lib/python3.8/site-packages/joblib/parallel.py in <module>
24 from .logger import Logger, short_format_time
25 from .disk import memstr_to_bytes
---> 26 from ._parallel_backends import (FallbackToBackend, MultiprocessingBackend,
27 ThreadingBackend, SequentialBackend,
28 LokyBackend)
~/anaconda3/lib/python3.8/site-packages/joblib/_parallel_backends.py in <module>
17 from .pool import MemmappingPool
18 from multiprocessing.pool import ThreadPool
---> 19 from .executor import get_memmapping_executor
20
21 # Compat between concurrent.futures and multiprocessing TimeoutError
~/anaconda3/lib/python3.8/site-packages/joblib/executor.py in <module>
10
11 from ._memmapping_reducer import get_memmapping_reducers
---> 12 from ._memmapping_reducer import TemporaryResourcesManager
13 from .externals.loky.reusable_executor import _ReusablePoolExecutor
14
ImportError: cannot import name 'TemporaryResourcesManager' from 'joblib._memmapping_reducer' (/home/user/anaconda3/lib/python3.8/site-packages/joblib/_memmapping_reducer.py)
How could I fix that error, which I think is related to joblib? Thanks a lot.
make sure your python version is >=3.8.0
modify this file
python3.8/site-packages/joblib/externals/cloudpickle/cloudpickle.py
line 135
change to
co.co_kwonlyargcount,
0,
co.co_nlocals,

ModuleNotFoundError: No module named 'numpy.testing.decorators'

I really need some help, as I have gone through all the posts and nothing has worked. I get this error when importing gensim and not numpy (numpy is before and works fine). All I want to do is import gensim and numpy to then run my analysis.
Here is the full error message:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-3f0b98039a34> in <module>()
1 # pip install --user numpy==1.16.4
2
----> 3 import gensim
4 #import numpy
5
~/.local/lib64/python3.6/site-packages/gensim/__init__.py in <module>()
9 import logging
10
---> 11 from gensim import parsing, corpora, matutils, interfaces, models, similarities, utils # noqa:F401
12
13
~/.local/lib64/python3.6/site-packages/gensim/corpora/__init__.py in <module>()
4
5 # bring corpus classes directly into package namespace, to save some typing
----> 6 from .indexedcorpus import IndexedCorpus # noqa:F401 must appear before the other classes
7
8 from .mmcorpus import MmCorpus # noqa:F401
~/.local/lib64/python3.6/site-packages/gensim/corpora/indexedcorpus.py in <module>()
12 import numpy
13
---> 14 from gensim import interfaces, utils
15
16 logger = logging.getLogger(__name__)
~/.local/lib64/python3.6/site-packages/gensim/interfaces.py in <module>()
17 import logging
18
---> 19 from gensim import utils, matutils
20
21
~/.local/lib64/python3.6/site-packages/gensim/matutils.py in <module>()
17 import numpy as np
18 import scipy.sparse
---> 19 from scipy.stats import entropy
20 import scipy.linalg
21 from scipy.linalg.lapack import get_lapack_funcs
/cluster/apps/python/3.6.4_cpu/lib64/python3.6/site-packages/scipy/stats/__init__.py in <module>()
343 from .stats import *
344 from .distributions import *
--> 345 from .morestats import *
346 from ._binned_statistic import *
347 from .kde import gaussian_kde
/cluster/apps/python/3.6.4_cpu/lib64/python3.6/site-packages/scipy/stats/morestats.py in <module>()
10 sqrt, ceil, floor, array, compress,
11 pi, exp, ravel, count_nonzero, sin, cos, arctan2, hypot)
---> 12 from numpy.testing.decorators import setastest
13
14 from scipy._lib.six import string_types
ModuleNotFoundError: No module named 'numpy.testing.decorators'
What I have tried:
I have tried using the latest version of numpy, and also forcing it to the version 1.16.4 "pip install --user numpy==1.16.4". I have also tried uninstalling and reinstalling both gensim and numpy, but its not working. I am using Python 3.6 and on a cluster. I don't really understand why numpy has no problem being imported, but that this is a problem of gensim.
Can anyone kindly help me out with this?
Thanks a lot!
Best,
Sandra

Torchtext on Colab: Cannot import name 'dtype_to_attr'

having trouble importing torchtext.data or .datasets with the following error on Google Colab. Tried to 1/ upgrade torch to 1.7, 2/ upgrade torchtext to 0.4 or 0.5 or latest as per some posts. But none seem to help.
Wondering if you have any insights here? Trying to import to embed / tokenize word sequences.
ImportError Traceback (most recent call last)
in ()
1 # For data loading.
----> 2 from torchtext import data, datasets
2 frames
/usr/local/lib/python3.6/dist-packages/torchtext/data/field.py in ()
8 from .dataset import Dataset
9 from .pipeline import Pipeline
---> 10 from .utils import get_tokenizer, dtype_to_attr, is_tokenizer_serializable
11 from ..vocab import Vocab, SubwordVocab
12
ImportError: cannot import name 'dtype_to_attr'

Python RASA - Error "object() takes no parameters" while importing "from rasa_core.agent import Agent"

Import command:
"from rasa_core.agent import Agent"
gives me the following error
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-43-bdf78c35345b> in <module>()
5 from rasa_core import training
6 from rasa_core.actions import Action
----> 7 from rasa_core.agent import Agent
8 from rasa_core.domain import Domain
9 from rasa_core.policies.keras_policy import KerasPolicy
C:\ProgramData\Miniconda3\lib\site-packages\rasa_core\agent.py in <module>()
15 import rasa_core
16 from rasa_core import training, constants
---> 17 from rasa_core.channels import UserMessage, OutputChannel, InputChannel
18 from rasa_core.constants import DEFAULT_REQUEST_TIMEOUT
19 from rasa_core.dispatcher import Dispatcher
C:\ProgramData\Miniconda3\lib\site-packages\rasa_core\channels\__init__.py in <module>()
15 from rasa_core.channels.botframework import BotFrameworkInput # nopep8
16 from rasa_core.channels.callback import CallbackInput # nopep8
---> 17 from rasa_core.channels.console import CmdlineInput # nopep8
18 from rasa_core.channels.facebook import FacebookInput # nopep8
19 from rasa_core.channels.mattermost import MattermostInput # nopep8
C:\ProgramData\Miniconda3\lib\site-packages\rasa_core\channels\console.py in <module>()
1 # this builtin is needed so we can overwrite in test
----> 2 import questionary
3
4 import json
5 import requests
C:\ProgramData\Miniconda3\lib\site-packages\questionary\__init__.py in <module>()
3
4 import questionary.version
----> 5 from questionary.form import Form
6 from questionary.form import form
7 from questionary.prompt import prompt
C:\ProgramData\Miniconda3\lib\site-packages\questionary\form.py in <module>()
1 from collections import namedtuple
2
----> 3 from questionary.constants import DEFAULT_KBI_MESSAGE
4 from questionary.question import Question
5
C:\ProgramData\Miniconda3\lib\site-packages\questionary\constants.py in <module>()
38 ('selected', ''), # style for a selected item of a checkbox
39 ('separator', ''), # separator in lists
---> 40 ('instruction', '') # user instructions for select, rawselect, checkbox
41 ])
TypeError: object() takes no parameters
This error also reappears in some other Rasa imports.
Following are my versions:
Python - 3.6.6
rasa_core - 0.13.3
rasa_nlu- 0.14.4
There is a requirement list that is available online but the answer where it was posted resulted in error still not resolving.
Any help is appreciated.
I had faced a similar issue.
Installing the following libraries with the version should resolve the error:
python==3.6.7
rasa_core==0.9.6
rasa_nlu==0.14.4
spacy==2.0.18
pandas==0.22.0
sklearn_crfsuite== 0.3.6
Cheers!
Edit: Make sure you create a new python environment while installing the above to avoid interdependency issues.

Google Dopamine

I was importing some dopamine dependencies, and I got an error saying No module named DopamineKit found. I then installed it separately using the code: !pip install dopaminekit. It installed dopaminekit module, but I am still getting a similar error. I have attached my code, and error below. I would really appreciate, if anyone is able to help me through this.
import numpy as np
import os
from dopamine.agents.dqn import dqn_agent
from dopamine.atari import run_experiment
from dopamine.colab import utils as utils_colab
from absl import flags
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-18-c5b224b9c6df> in <module>()
1 import numpy as np
2 import os
----> 3 from dopamine.agents.dqn import dqn_agent
4 from dopamine.atari import run_experiment
5 from dopamine.colab import utils as utils_colab
/usr/local/lib/python3.6/dist-packages/dopamine/__init__.py in <module>()
3 ## This is solely used to import the class DopamineKit
4
----> 5 from dopaminekit import DopamineKit
/usr/local/lib/python3.6/dist-packages/dopaminekit/__init__.py in <module>()
3 ## This is solely used to import the class DopamineKit
4
----> 5 from dopaminekit import DopamineKit
ImportError: cannot import name 'DopamineKit'

Categories

Resources