Error starting the Jupyter notebook on Windows - anaconda

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.

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.

Importing pandas in windows

I tried multiple methods with Anaconda and python both using version 3.6 and when I import pandas I'm getting the following error in my Windows machine
import pandas
File "D:\python3\lib\site-packages\pandas\__init__.py", line 22, in <module>
from pandas.compat.numpy import *
File "D:\python3\lib\site-packages\pandas\compat\__init__.py", line 59, in <module>
import http.client as httplib
File "D:\python3\lib\http\client.py", line 71, in <module>
import email.parser
File "D:\email.py", line 5, in <module>
import pandas.io.sql as psql
File "D:\python3\lib\site-packages\pandas\io\sql.py", line 14, in <module>
import pandas.lib as lib
File "pandas\lib.pyx", line 1, in init pandas.lib (pandas\lib.c:90879)
File "pandas\tslib.pyx", line 59, in init pandas.tslib (pandas\tslib.c:115313)
ImportError: cannot import name is_platform_windows
It seems to be environment related but I can't find anything related to this issue when I google this.
Looks like it was picking anything python script in my folder called email.py and that's causing the issue.

ImportError: No module named 'ruamel' running 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?

Resources