Sympy is downloaded with anaconda. In a Jupyter notebook, I have 'from sympy import divisors' and I get this:
ModuleNotFoundError Traceback (most recent call last)
Cell In[12], line 1
----> 1 from sympy import divisors
File ~/Desktop/anaconda3/lib/python3.9/site-packages/sympy/__init__.py:107
70 from .assumptions import (AppliedPredicate, Predicate, AssumptionsContext,
71 assuming, Q, ask, register_handler, remove_handler, refine)
73 from .polys import (Poly, PurePoly, poly_from_expr, parallel_poly_from_expr,
74 degree, total_degree, degree_list, LC, LM, LT, pdiv, prem, pquo,
75 pexquo, div, rem, quo, exquo, half_gcdex, gcdex, invert,
(...)
104 laguerre_poly, apart, apart_list, assemble_partfrac_list, Options,
105 ring, xring, vring, sring, field, xfield, vfield, sfield)
--> 107 from .series import (Order, O, limit, Limit, gruntz, series, approximants,
108 residue, EmptySequence, SeqPer, SeqFormula, sequence, SeqAdd, SeqMul,
109 fourier_series, fps, difference_delta, limit_seq)
111 from .functions import (factorial, factorial2, rf, ff, binomial,
112 RisingFactorial, FallingFactorial, subfactorial, carmichael,
113 fibonacci, lucas, motzkin, tribonacci, harmonic, bernoulli, bell, euler,
(...)
132 Znm, elliptic_k, elliptic_f, elliptic_e, elliptic_pi, beta, mathieus,
133 mathieuc, mathieusprime, mathieucprime, riemann_xi, betainc, betainc_regularized)
135 from .ntheory import (nextprime, prevprime, prime, primepi, primerange,
136 randprime, Sieve, sieve, primorial, cycle_length, composite,
137 compositepi, isprime, divisors, proper_divisors, factorint,
(...)
148 continued_fraction_iterator, continued_fraction_reduce,
149 continued_fraction_convergents, continued_fraction, egyptian_fraction)
File ~/Desktop/anaconda3/lib/python3.9/site-packages/sympy/series/__init__.py:7
5 from .gruntz import gruntz
6 from .series import series
----> 7 from .approximants import approximants
8 from .residues import residue
9 from .sequences import SeqPer, SeqFormula, sequence, SeqAdd, SeqMul
ModuleNotFoundError: No module named 'sympy.series.approximants'
Any ideas on what I am doing wrong? Thank you.
Tried using the terminal to update, but I am garbage with anything beyond the basics.
Whenever I try importing cfgrib it gives me runtime error that it could not load ecCodes library
import cfgrib
Here's the full error message
RuntimeError Traceback (most recent call last)
/tmp/ipykernel_6224/857012844.py in <module>
----> 1 import cfgrib
~/.local/lib/python3.8/site-packages/cfgrib/__init__.py in <module>
17
18 # cfgrib core API depends on the ECMWF ecCodes C-library only
---> 19 from .cfmessage import CfMessage
20 from .dataset import Dataset, DatasetBuildError, open_file, open_fileindex
21 from .messages import FileStream, Message
~/.local/lib/python3.8/site-packages/cfgrib/cfmessage.py in <module>
27 import numpy as np
28
---> 29 from . import abc, messages
30
31 LOG = logging.getLogger(__name__)
~/.local/lib/python3.8/site-packages/cfgrib/messages.py in <module>
26
27 import attr
---> 28 import eccodes # type: ignore
29 import numpy as np
30
~/.local/lib/python3.8/site-packages/eccodes/__init__.py in <module>
13 import sys
14
---> 15 from .eccodes import *
16 from .eccodes import __version__
17 from .eccodes import bindings_version
~/.local/lib/python3.8/site-packages/eccodes/eccodes.py in <module>
10 #
11 #
---> 12 from gribapi import __version__
13 from gribapi import bindings_version
14
~/.local/lib/python3.8/site-packages/gribapi/__init__.py in <module>
11 #
12
---> 13 from .gribapi import * # noqa
14 from .gribapi import __version__
15 from .gribapi import bindings_version
~/.local/lib/python3.8/site-packages/gribapi/gribapi.py in <module>
2226
2227
-> 2228 __version__ = grib_get_api_version()
2229
2230
~/.local/lib/python3.8/site-packages/gribapi/gribapi.py in grib_get_api_version()
2216
2217 if not lib:
-> 2218 raise RuntimeError("Could not load the ecCodes library!")
2219
2220 v = lib.grib_get_api_version()
RuntimeError: Could not load the ecCodes library!
I have installed cfgrib and ecCodes through pip
cfgrib 0.9.9.1
eccodes 1.4.0
eccodes-python 0.9.9
As stated on pypi (https://pypi.org/project/eccodes/) the eccodes python package relies on the eccodes system library. Based on the error message, you do not have it installed.
It is probably easiest to install it using conda:
conda install -c conda-forge eccodes
I'm trying to use SimpleTransformers module for this competition.
After successfully installing the package SimpleTransformers in kernel , i'm trying to import NERModel and NERArgs packages from simpletransformers.ner. But i get error message as below.
**
!pip install SimpleTransformers
#(The above statement works fine.)
from simpletransformers.ner import NERModel,NERArgs
#(While executing the above statement , getting below error)
ImportError Traceback (most recent call last)
in
1 get_ipython().system('pip install --upgrade fsspec')
----> 2 from simpletransformers.ner import NERModel,NERArgs
/opt/conda/lib/python3.7/site-packages/simpletransformers/ner/init.py in
1 from simpletransformers.config.model_args import NERArgs
----> 2 from simpletransformers.ner.ner_model import NERModel
/opt/conda/lib/python3.7/site-packages/simpletransformers/ner/ner_model.py in
30 )
31 from transformers.optimization import AdamW, Adafactor
---> 32 from transformers import (
33 AlbertConfig,
34 AlbertForTokenClassification,
/opt/conda/lib/python3.7/site-packages/transformers/init.py in getattr(self, name)
2485 if name == "version":
2486 return version
-> 2487 return super().getattr(name)
2488
2489 sys.modules[name] = _LazyModule(name, _import_structure)
/opt/conda/lib/python3.7/site-packages/transformers/file_utils.py in getattr(self, name)
1698 elif name in self._class_to_module.keys():
1699 module = self._get_module(self._class_to_module[name])
-> 1700 value = getattr(module, name)
1701 else:
1702 raise AttributeError(f"module {self.name} has no attribute {name}")
/opt/conda/lib/python3.7/site-packages/transformers/file_utils.py in getattr(self, name)
1697 value = self._get_module(name)
1698 elif name in self._class_to_module.keys():
-> 1699 module = self._get_module(self._class_to_module[name])
1700 value = getattr(module, name)
1701 else:
/opt/conda/lib/python3.7/site-packages/transformers/models/auto/init.py in _get_module(self, module_name)
196
197 def _get_module(self, module_name: str):
--> 198 return importlib.import_module("." + module_name, self.name)
199
200 sys.modules[name] = _LazyModule(name, _import_structure)
/opt/conda/lib/python3.7/importlib/init.py in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129
/opt/conda/lib/python3.7/site-packages/transformers/models/auto/modeling_auto.py in
197 from ..pegasus.modeling_pegasus import PegasusForCausalLM, PegasusForConditionalGeneration, PegasusModel
198 from ..prophetnet.modeling_prophetnet import ProphetNetForCausalLM, ProphetNetForConditionalGeneration, ProphetNetModel
--> 199 from ..rag.modeling_rag import ( # noqa: F401 - need to import all RagModels to be in globals() function
200 RagModel,
201 RagSequenceForGeneration,
/opt/conda/lib/python3.7/site-packages/transformers/models/rag/modeling_rag.py in
27 from …utils import logging
28 from .configuration_rag import RagConfig
---> 29 from .retrieval_rag import RagRetriever
30
31
/opt/conda/lib/python3.7/site-packages/transformers/models/rag/retrieval_rag.py in
37
38 if is_datasets_available():
---> 39 from datasets import Dataset, load_dataset, load_from_disk
40
41 if is_faiss_available():
/opt/conda/lib/python3.7/site-packages/datasets/init.py in
31 )
32
---> 33 from .arrow_dataset import Dataset, concatenate_datasets
34 from .arrow_reader import ArrowReader, ReadInstruction
35 from .arrow_writer import ArrowWriter
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in
44 from .arrow_writer import ArrowWriter, OptimizedTypedSequence
45 from .features import ClassLabel, Features, Value, cast_to_python_objects
---> 46 from .filesystems import extract_path_from_uri, is_remote_filesystem
47 from .fingerprint import (
48 fingerprint_transform,
/opt/conda/lib/python3.7/site-packages/datasets/filesystems/init.py in
7
8 if _has_s3fs:
----> 9 from .s3filesystem import S3FileSystem # noqa: F401
10
11
/opt/conda/lib/python3.7/site-packages/datasets/filesystems/s3filesystem.py in
----> 1 import s3fs
2
3
4 class S3FileSystem(s3fs.S3FileSystem):
5 """
/opt/conda/lib/python3.7/site-packages/s3fs/init.py in
----> 1 from .core import S3FileSystem, S3File
2 from .mapping import S3Map
3
4 from ._version import get_versions
5
/opt/conda/lib/python3.7/site-packages/s3fs/core.py in
9
10 from fsspec.spec import AbstractBufferedFile
---> 11 from fsspec.utils import infer_storage_options, tokenize, setup_logging
12 from fsspec.asyn import AsyncFileSystem, sync, sync_wrapper
13
ImportError: cannot import name 'setup_logging' from 'fsspec.utils' (/opt/conda/lib/python3.7/site-packages/fsspec/utils.py)
This has become show stopper for me in kaggle.The same code works in Colab.Please advice.**
Thanks,
Shyam.
fsspec==0.9.0 has the function fsspec.utils.setup_logging but earlier versions do not
Try pip install fsspec==0.9.0
see: https://githubmemory.com/repo/dask/s3fs/activity?page=3
I've been able to install rpy2 via conda:
conda install -c r rpy2
However, the only function that works is:
import rpy2
I confirm I'm running:
rpy v 2.9.0
3.5.2 |Anaconda custom (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]
Window 10
Error example:
from rpy2 import robjects
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-46-1f019d00d232> in <module>()
----> 1 from rpy2 import robjects
C:\Users\cfeld\AppData\Local\Continuum\Anaconda3\lib\site-packages\rpy2-2.9.0-py3.5-win-amd64.egg\rpy2\robjects\__init__.py in <module>()
14 import itertools
15 from datetime import datetime
---> 16 import rpy2.rinterface as rinterface
17 import rpy2.rlike.container as rlc
18
C:\Users\cfeld\AppData\Local\Continuum\Anaconda3\lib\site-packages\rpy2-2.9.0-py3.5-win-amd64.egg\rpy2\rinterface\__init__.py in <module>()
43
44 if sys.platform == 'win32':
---> 45 _load_r_dll(R_HOME)
46
47 # cleanup the namespace
C:\Users\cfeld\AppData\Local\Continuum\Anaconda3\lib\site-packages\rpy2-2.9.0-py3.5-win-amd64.egg\rpy2\rinterface\__init__.py in _load_r_dll(r_home)
27 if r_bin not in os.environ.get('PATH'):
28 os.environ['PATH'] = ';'.join((os.environ.get('PATH'), r_bin, r_mod))
---> 29 ctypes.CDLL(r_dll)
30
31 R_HOME = get_r_home()
C:\Users\cfeld\AppData\Local\Continuum\Anaconda3\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
345
346 if handle is None:
--> 347 self._handle = _dlopen(self._name, mode)
348 else:
349 self._handle = handle
OSError: [WinError 126] The specified module could not be found
Any suggestions?
I'm currently having issues trying to load rmagic into IPython since I upgraded to OSX Yosemite.
I'm using the following command:
%load_ext rmagic
Below is the error I'm getting, and I'm not sure if it's because I upgraded to Yosemite or because I'm trying to load R incorrectly. I've pasted all the Traceback in case that's useful, but the error ends in
ImportError: cannot import name conversion
My R version is 3.1.1
My Python version is 2.7.6
My IPython version is 2.3.0
Not sure what version rpy2 is, but I only downloaded it a few days ago so I assume it's the latest.
ImportError Traceback (most recent call last)
<ipython-input-7-691c6d73b073> in <module>()
----> 1 get_ipython().magic(u'load_ext rpy2.ipython')
/Library/Python/2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2203 magic_name, _, magic_arg_s = arg_s.partition(' ')
2204 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2205 return self.run_line_magic(magic_name, magic_arg_s)
2206
2207 #-------------------------------------------------------------------------
/Library/Python/2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2124 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2125 with self.builtin_trap:
-> 2126 result = fn(*args,**kwargs)
2127 return result
2128
/Library/Python/2.7/site-packages/IPython/core/magics/extension.pyc in load_ext(self, module_str)
/Library/Python/2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
194
195 if callable(arg):
/Library/Python/2.7/site-packages/IPython/core/magics/extension.pyc in load_ext(self, module_str)
61 if not module_str:
62 raise UsageError('Missing module name.')
---> 63 res = self.shell.extension_manager.load_extension(module_str)
64
65 if res == 'already loaded':
/Library/Python/2.7/site-packages/IPython/core/extensions.pyc in load_extension(self, module_str)
96 if module_str not in sys.modules:
97 with prepended_to_syspath(self.ipython_extension_dir):
---> 98 __import__(module_str)
99 mod = sys.modules[module_str]
100 if self._call_load_ipython_extension(mod):
/Library/Python/2.7/site-packages/rpy2/ipython/__init__.py in <module>()
----> 1 from .rmagic import load_ipython_extension
/Library/Python/2.7/site-packages/rpy2/ipython/rmagic.py in <module>()
51
52 import rpy2.rinterface as ri
---> 53 import rpy2.robjects as ro
54 import rpy2.robjects.packages as rpacks
55
/Library/Python/2.7/site-packages/rpy2/robjects/__init__.py in <module>()
16 import rpy2.rlike.container as rlc
17
---> 18 from rpy2.robjects.robject import RObjectMixin, RObject
19 from rpy2.robjects.vectors import *
20 from rpy2.robjects.functions import Function, SignatureTranslatedFunction
/Library/Python/2.7/site-packages/rpy2/robjects/robject.py in <module>()
5 rpy2.rinterface.initr()
6
----> 7 from . import conversion
8
9 class RObjectMixin(object):
ImportError: cannot import name conversion
Minrk had it right - uninstalling and reinstalling rpy2 fixed my problem. Not sure why I didn't think of that before! Thanks.