How to make jupyter-lab command global - python

I've added "C:\Users\sj\anaconda3\Scripts" to System environment variable list, but I got the following result.
C:\Users\sj>jupyter-lab
Traceback (most recent call last):
File "C:\Users\sj\anaconda3\lib\site-packages\jupyter_server\services\sessions\sessionmanager.py", line 8, in <module>
import sqlite3
File "C:\Users\sj\anaconda3\lib\sqlite3\__init__.py", line 57, in <module>
from sqlite3.dbapi2 import *
File "C:\Users\sj\anaconda3\lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed while importing _sqlite3: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\sj\anaconda3\Scripts\jupyter-lab-script.py", line 5, in <module>
from jupyterlab.labapp import main
File "C:\Users\sj\anaconda3\lib\site-packages\jupyterlab\labapp.py", line 13, in <module>
from jupyter_server.serverapp import flags
File "C:\Users\sj\anaconda3\lib\site-packages\jupyter_server\serverapp.py", line 83, in <module>
from jupyter_server.services.sessions.sessionmanager import SessionManager
File "C:\Users\sj\anaconda3\lib\site-packages\jupyter_server\services\sessions\sessionmanager.py", line 11, in <module>
from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'
Could anyone help me to fix this and make "jupyter-lab" and "jupyter-notebook" global?

Related

Numpy attempts to import the packages that it depends on from my project folder instead of the package install directory

I have python 3.8 and numpy 1.19.2 installed. Recently when I wrote in a blank REPL,
import numpy
I received this error:
Traceback (most recent call last):
File "/home/rev/anaconda3/lib/python3.8/site-packages/numpy/compat/py3k.py", line 28, in <module>
import pickle5 as pickle
File "/home/rev/anaconda3/lib/python3.8/site-packages/pickle5/__init__.py", line 1, in <module>
from .pickle import *
File "/home/rev/anaconda3/lib/python3.8/site-packages/pickle5/pickle.py", line 33, in <module>
from struct import pack, unpack
ImportError: cannot import name 'pack' from 'struct' (/home/rev/Dokumenter/phd/tight/phd-2022/src/struct.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/rev/anaconda3/lib/python3.8/site-packages/numpy/__init__.py", line 140, in <module>
from . import core
File "/home/rev/anaconda3/lib/python3.8/site-packages/numpy/core/__init__.py", line 70, in <module>
from . import numerictypes as nt
File "/home/rev/anaconda3/lib/python3.8/site-packages/numpy/core/numerictypes.py", line 107, in <module>
from ._type_aliases import (
File "/home/rev/anaconda3/lib/python3.8/site-packages/numpy/core/_type_aliases.py", line 27, in <module>
from numpy.compat import unicode
File "/home/rev/anaconda3/lib/python3.8/site-packages/numpy/compat/__init__.py", line 12, in <module>
from . import py3k
File "/home/rev/anaconda3/lib/python3.8/site-packages/numpy/compat/py3k.py", line 30, in <module>
import pickle
File "/home/rev/anaconda3/lib/python3.8/pickle.py", line 33, in <module>
from struct import pack, unpack
ImportError: cannot import name 'pack' from 'struct' (/home/rev/Dokumenter/phd/tight/phd-2022/src/struct.py)
It seemed somehow it reacts to the file struct.py that is a recently created file somewhere in one of my Ph.D.-project-directories. After I renamed the file to struc.py, all was well.
How can I avoid this in the future? It's a problem if my documents starts crashing numpy.

Unable to import Spacy in Python 3.7

I have tried by installing spacy in new virtual environment as well just in case if there are any module version clashes but still gives the same error upon doing the spacy import
import spacy
Also tried with downgrading of the spacy version to 2.2.2.
Error Log:
Traceback (most recent call last):
File "/Users/testUser/.virtualenvs/mlv3/lib/python3.7/site-packages/catalogue.py", line 8, in <module>
import importlib.metadata as importlib_metadata
ModuleNotFoundError: No module named 'importlib.metadata'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/testUser/Desktop/ml/test-project/src/EmailParser.py", line 3, in <module>
import spacy
File "/Users/testUser/.virtualenvs/mlv3/lib/python3.7/site-packages/spacy/__init__.py", line 10, in <module>
from thinc.neural.util import prefer_gpu, require_gpu
File "/Users/testUser/.virtualenvs/mlv3/lib/python3.7/site-packages/thinc/__init__.py", line 8, in <module>
from ._registry import registry
File "/Users/testUser/.virtualenvs/mlv3/lib/python3.7/site-packages/thinc/_registry.py", line 1, in <module>
import catalogue
File "/Users/testUser/.virtualenvs/mlv3/lib/python3.7/site-packages/catalogue.py", line 10, in <module>
import importlib_metadata
File "/Users/testUser/.virtualenvs/mlv3/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 16, in <module>
from ._compat import (
File "/Users/testUser/.virtualenvs/mlv3/lib/python3.7/site-packages/importlib_metadata/_compat.py", line 115, in <module>
email.message_from_string
AttributeError: module 'email' has no attribute 'message_from_string'

Anaconda error while opening prompt

Whenever I open Anaconda prompt, I get this
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\souvi\Anaconda3\lib\ctypes\__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: DLL load failed: %1 is not a valid Win32 application.
Traceback (most recent call last):
File "C:\Users\souvi\Anaconda3\lib\site-packages\conda\cli\main.py", line 170, in main
import conda.cli.activate as activate
File "C:\Users\souvi\Anaconda3\lib\site-packages\conda\cli\activate.py", line 10, in <module>
from ..exceptions import (ArgumentError, CondaEnvironmentError, CondaSystemExit, CondaValueError,
File "C:\Users\souvi\Anaconda3\lib\site-packages\conda\exceptions.py", line 16, in <module>
from .common.url import maybe_unquote
File "C:\Users\souvi\Anaconda3\lib\site-packages\conda\common\url.py", line 8, in <module>
import socket
File "C:\Users\souvi\Anaconda3\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\souvi\Anaconda3\Scripts\conda-script.py", line 5, in <module>
sys.exit(conda.cli.main())
File "C:\Users\souvi\Anaconda3\lib\site-packages\conda\cli\main.py", line 177, in main
from ..exceptions import handle_exception
File "C:\Users\souvi\Anaconda3\lib\site-packages\conda\exceptions.py", line 16, in <module>
from .common.url import maybe_unquote
File "C:\Users\souvi\Anaconda3\lib\site-packages\conda\common\url.py", line 8, in <module>
import socket
File "C:\Users\souvi\Anaconda3\lib\socket.py", line 49, in <module>
import _socket
ImportError: DLL load failed: %1 is not a valid Win32 application.
It worked perfectly fine till a few days ago.
Also on cmd, when I type in the conda command, it displays:
C:\Users\souvi>conda
Traceback (most recent call last):
File "C:\Users\souvi\Anaconda3\Scripts\conda-script.py", line 5, in <module>
sys.exit(conda.cli.main())
File "C:\Users\souvi\Anaconda3\lib\site-packages\conda\cli\main.py", line 181, in main
from ..exceptions import conda_exception_handler
File "C:\Users\souvi\Anaconda3\lib\site-packages\conda\exceptions.py", line 16, in <module>
from .common.url import maybe_unquote
File "C:\Users\souvi\Anaconda3\lib\site-packages\conda\common\url.py", line 8, in <module>
import socket
File "C:\Users\souvi\Anaconda3\lib\socket.py", line 49, in <module>
import _socket
ImportError: DLL load failed: %1 is not a valid Win32 application.
How do I fix this?

2x ModuleNotFoundError Jupyter notebook

While attempting to run jupyter notebook in python3.6.3 on my gnome terminal I get the following output, running on UBUNTU:
Traceback (most recent call last):
File "/home/willem/.local/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 10, in <module>
import sqlite3
File "/usr/local/lib/python3.6/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.6/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/willem/.local/bin/jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/home/willem/.local/lib/python3.6/site-packages/notebook/notebookapp.py", line 81, in <module>
from .services.sessions.sessionmanager import SessionManager
File "/home/willem/.local/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 13, in <module>
from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'
However, the module sqlite3 is present in my python3.6.3 directory. Which makes the problem rather vague.
Any suggestions for this problem to be fixed will be greatly appreciated

Error message: ImportError: No module named _caffe

I tried to install that install Caffe Tutorial, but I am block at this line in the tuto: ./tools/demo.py
I havre this error message:
MacBook-Pro-de-OlostA:fast-rcnn OlostA$ ./tools/demo.py
Traceback (most recent call last):
File "./tools/demo.py", line 19, in <module>
from fast_rcnn.config import cfg
File "/Users/OlostA/Technologies/fast-rcnn/tools/../lib/fast_rcnn/__init__.py", line 9, in <module>
from . import train
File "/Users/OlostA/Technologies/fast-rcnn/tools/../lib/fast_rcnn/train.py", line 10, in <module>
import caffe
File "/Users/OlostA/Technologies/fast-rcnn/tools/../caffe-fast-rcnn/python/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver
File "/Users/OlostA/Technologies/fast-rcnn/tools/../caffe-fast-rcnn/python/caffe/pycaffe.py", line 13, in <module>
from ._caffe import Net, SGDSolver
ImportError: No module named _caffe
Thanks in advance.

Categories