ImportError: No module named 'ruamel' running Anaconda - anaconda

I am using MacOS X 10.11.2 and I want to install Anaconda 3, so that I downloaded the Anaconda3-4.3.0-MacOSX-x86_64.pkg from here. After I installed, I tried runnging this but I got the error like the following.
S0106602ad06e3352:bin jouk$ conda
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/conda/common/configuration.py", line 38, in <module>
from ruamel_yaml.comments import CommentedSeq, CommentedMap
ImportError: No module named 'ruamel_yaml'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/bin/conda", line 7, in <module>
from conda.cli.main import main
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/conda/cli/__init__.py", line 8, in <module>
from .main import main # NOQA
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/conda/cli/main.py", line 46, in <module>
from ..base.context import context
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/conda/base/context.py", line 18, in <module>
from ..common.configuration import (Configuration, MapParameter, PrimitiveParameter,
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/conda/common/configuration.py", line 40, in <module>
from ruamel.yaml.comments import CommentedSeq, CommentedMap # pragma: no cover
ImportError: No module named 'ruamel'
S0106602ad06e3352:bin jouk$
I tried solving this error with this workaround (here). But in this case is for the case in which I installed Anaconda twice to two places in local. But, I didn't do that. What is my problem?

Related

Installing `transformers` on HPC Cluster

I'm trying to install the transformers library on HPC. I do:
git clone https://github.com/huggingface/transformers.git
cd transformers
pip install -e . --user
All three of these work as expected, with the last output being:
Successfully installed dataclasses-0.7 numpy-1.19.0 tokenizers-0.8.1rc2 transformers
Then, I try python -c "import transformers" but I get the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/maths/btech/mt1170727/transformers/src/transformers/__init__.py", line 23, in <module>
from .configuration_albert import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, AlbertConfig
File "/home/maths/btech/mt1170727/transformers/src/transformers/configuration_albert.py", line 18, in <module>
from .configuration_utils import PretrainedConfig
File "/home/maths/btech/mt1170727/transformers/src/transformers/configuration_utils.py", line 25, in <module>
from .file_utils import CONFIG_NAME, cached_path, hf_bucket_url, is_remote_url
File "/home/maths/btech/mt1170727/transformers/src/transformers/file_utils.py", line 37, in <module>
import torch
File "/home/soft/PYTHON/3.6.0/ucs4/gnu/447/lib/python3.6/site-packages/torch/__init__.py", line 125, in <module>
_load_global_deps()
File "/home/soft/PYTHON/3.6.0/ucs4/gnu/447/lib/python3.6/site-packages/torch/__init__.py", line 83, in _load_global_deps
ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
File "/home/soft/PYTHON/3.6.0/ucs4/gnu/447/lib/python3.6/ctypes/__init__.py", line 344, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libnvToolsExt.so.1: cannot open shared object file: No such file or directory
I have done as was written in the documentation, and can't see why I'm facing this error. Any help would be great. Thanks...

Failed to start spyder kernel after setting Python interpreter to new environment

I made a new environment where I installed geopandas, xarray, and regionmask. When I tried to switch environment using the modular approach (by installing spyder-kernels in the new environment and indicating the new path to the environment in the Python interpreter, as indicated here: https://github.com/spyder-ide/spyder/wiki/Working-with-packages-and-environments-in-Spyder#the-modular-approach), an error persists while starting the kernel:
Traceback (most recent call last):
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\site‑packages\spyder_kernels\console\__main__.py", line 11, in
start.main()
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\site‑packages\spyder_kernels\console\start.py", line 288, in main
import_spydercustomize()
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\site‑packages\spyder_kernels\console\start.py", line 39, in import_spydercustomize
import spydercustomize
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\site‑packages\spyder_kernels\customize\spydercustomize.py", line 27, in
from spyder_kernels.comms.frontendcomm import CommError, frontend_request
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\site‑packages\spyder_kernels\comms\frontendcomm.py", line 17, in
from jupyter_client.localinterfaces import localhost
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\site‑packages\jupyter_client\__init__.py", line 4, in
from .connect import *
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\site‑packages\jupyter_client\connect.py", line 21, in
import zmq
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\site‑packages\zmq\__init__.py", line 47, in
from zmq import backend
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\site‑packages\zmq\backend\__init__.py", line 40, in
reraise(*exc_info)
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\site‑packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\site‑packages\zmq\backend\__init__.py", line 27, in
_ns = select_backend(first)
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\site‑packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\Justin\anaconda3\envs\geo_env\lib\site‑packages\zmq\backend\cython\__init__.py", line 6, in
from . import (constants, error, message, context,
ImportError: DLL load failed while importing error: The specified module could not be found.
How can I debug this?
(Spyder maintainer here) This problem was fixed in this pull request, which is going to be part of Spyder 4.1.0, to be released later in March 2020.

I keep getting ModuleNotFoundError: No module named 'Crypto' but i have pycryptodome installed

I am using web3.py in my app, and things were working smoothly until I received this error.
Traceback (most recent call last):
File "run.py", line 1, in <module>
from api import app
File "C:\Users\Ty Cooper\Desktop\Coding\Projects\streamline\server\api\__init__.py", line 8, in <module>
from web3 import Web3
File "C:\Users\Ty Cooper\AppData\Local\Programs\Python\Python37\lib\site-packages\web3\__init__.py", line 7, in <module>
from eth_account import Account # noqa: E402
File "C:\Users\Ty Cooper\AppData\Local\Programs\Python\Python37\lib\site-packages\eth_account\__init__.py", line 1, in <module>
from eth_account.account import Account # noqa: F401
File "C:\Users\Ty Cooper\AppData\Local\Programs\Python\Python37\lib\site-packages\eth_account\account.py", line 10, in <module>
from eth_keyfile import (
File "C:\Users\Ty Cooper\AppData\Local\Programs\Python\Python37\lib\site-packages\eth_keyfile\__init__.py", line 7, in <module>
from eth_keyfile.keyfile import ( # noqa: F401
File "C:\Users\Ty Cooper\AppData\Local\Programs\Python\Python37\lib\site-packages\eth_keyfile\keyfile.py", line 5, in <module>
from Crypto import Random
ModuleNotFoundError: No module named 'Crypto'
I have looked online to install pycryptodome and I have tried that and it is installed, but for some reason this error persist to populate.
I have found the issue. It was a naming error! I went to the site packages in
File "C:\Users\Ty Cooper\AppData\Local\Programs\Python\Python37\lib\site-packages\eth_keyfile\keyfile.py", line 5, in <module>
from Crypto import Random
and I just capitalize all of the folder names.

Error starting the Jupyter notebook on Windows

When I write jupyter notebookon my on command prompt, I get an error on cmd while running jupyter. I don't understand why this is happening again and again. Therefore, it blocks to open jupyter editor in the browser. I have added all environment variables as usual, but it's not working yet. Could you please help to solve this? Any kinds of suggestions are welcome.
H:\Research\NLP\NLP Task 1>jupyter notebook
Traceback (most recent call last):
File "C:\Users\Imran\Anaconda3\lib\site-packages\notebook\nbextensions.py", line 18, in <module>
from urllib.request import urlretrieve
File "C:\Users\Imran\AppData\Local\Programs\Python\Python36-32\Lib\urllib\request.py", line 88, in <module>
import http.client
File "C:\Users\Imran\AppData\Local\Programs\Python\Python36-32\Lib\http\client.py", line 71, in <module>
import email.parser
File "C:\Users\Imran\AppData\Local\Programs\Python\Python36-32\Lib\email\parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "C:\Users\Imran\AppData\Local\Programs\Python\Python36-32\Lib\email\feedparser.py", line 27, in <module>
from email._policybase import compat32
File "C:\Users\Imran\AppData\Local\Programs\Python\Python36-32\Lib\email\_policybase.py", line 9, in <module>
from email.utils import _has_surrogates
File "C:\Users\Imran\AppData\Local\Programs\Python\Python36-32\Lib\email\utils.py", line 29, in <module>
import socket
File "C:\Users\Imran\AppData\Local\Programs\Python\Python36-32\Lib\socket.py", line 49, in <module>
import _socket
ImportError: DLL load failed: %1 is not a valid Win32 application.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Imran\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Users\Imran\Anaconda3\lib\site-packages\notebook\__init__.py", line 25, in <module>
from .nbextensions import install_nbextension
File "C:\Users\Imran\Anaconda3\lib\site-packages\notebook\nbextensions.py", line 20, in <module>
from urlparse import urlparse
ModuleNotFoundError: No module named 'urlparse'
I uninstall python and anaconda. Then i reinstall it again. And it works again.

running package throws ImportError: No module named image

Using cx_freeze under ubuntu 12.04. The generation of the package is
done without any errors but when I try to run the package as a
standalone, I get the following error:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/initscripts /Console.py",
line 27, in <module>
exec code in m.__dict__
m m File "Setup_cx_freeze.py", line 3, in <module>
File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/__init__.py",
line 4, in <module>
from cx_Freeze.dist import *
File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/dist.py",
line 3, in <module>
import distutils.command.install
File "/usr/lib/python2.7/distutils/command/install.py", line 21, in <module>
from site import USER_BASE
File "/usr/lib/python2.7/site.py", line 562, in <module>
main()
File "/usr/lib/python2.7/site.py", line 540, in main
abs__file__()
File "/usr/lib/python2.7/site.py", line 100, in abs__file__
m.__file__ = os.path.abspath(m.__file__)
File "/usr/lib/python2.7/email/__init__.py", line 79, in __getattr__
__import__(self.__name__)
ImportError: No module named image
I think what to focus on is the last sentence. "ImportError: No module named image."
The application runs without any problems in pure python environment
So why do I get the Error when running it as a "freeze" package? The
fault is somehow introduced when generating the freeze-package.
I ended up fixing this by explicitly including the package "email.mime" in the setup.py script build exe options.
Missing 'image' is just first part of the problem. Try to add this to your code:
from email.mime.image import MIMEImage
from email.mime.audio import MIMEAudio
from email.mime.message import MIMEMessage
This resolved problems with 'image', 'audio' and 'message'.
Resolved this by installing Python Imaging Library: http://www.pythonware.com/products/pil/
1) python setup.py build
2) sudo python setup.py install

Resources