For now I was only using python 2.7 (installed for all users, added to path, windows 10 machine) but I want to switch to 3.8, to be able to use both of them I first installed virtualenv in my system python 2.7.
Then installed python 3.8.1 for all user without adding it to path.
Created my virtualenv like that : virtualenv c:\virtualEnvs\p38x64_jupytertest -p C:\Python38-32\python.exe
then activated it : C:\virtualEnvs\p38x64_jupytertest\Scripts\activate.bat
checked if python 3.8.1 was selected with : python --version (it was)
then installed jupyter inside my virtualenv : pip install jupyter
Then when I ran jupyter notebook I got
Traceback (most recent call last):
File "C:\Python38-32\Lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Python38-32\Lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "c:\virtualEnvs\p38x64_jupytertest3\Scripts\jupyter-notebook.EXE\__main__.py", line 7, in <module>
File "c:\virtualenvs\p38x64_jupytertest3\lib\site-packages\jupyter_core\application.py", line 268, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "c:\virtualenvs\p38x64_jupytertest3\lib\site-packages\traitlets\config\application.py", line 663, in launch_instance
app.initialize(argv)
File "<c:\virtualenvs\p38x64_jupytertest3\lib\site-packages\decorator.py:decorator-gen-7>", line 2, in initialize
File "c:\virtualenvs\p38x64_jupytertest3\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "c:\virtualenvs\p38x64_jupytertest3\lib\site-packages\notebook\notebookapp.py", line 1720, in initialize
self.init_webapp()
File "c:\virtualenvs\p38x64_jupytertest3\lib\site-packages\notebook\notebookapp.py", line 1482, in init_webapp
self.http_server.listen(port, self.ip)
File "c:\virtualenvs\p38x64_jupytertest3\lib\site-packages\tornado\tcpserver.py", line 152, in listen
self.add_sockets(sockets)
File "c:\virtualenvs\p38x64_jupytertest3\lib\site-packages\tornado\tcpserver.py", line 165, in add_sockets
self._handlers[sock.fileno()] = add_accept_handler(
File "c:\virtualenvs\p38x64_jupytertest3\lib\site-packages\tornado\netutil.py", line 279, in add_accept_handler
io_loop.add_handler(sock, accept_handler, IOLoop.READ)
File "c:\virtualenvs\p38x64_jupytertest3\lib\site-packages\tornado\platform\asyncio.py", line 99, in add_handler
self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
File "C:\Python38-32\Lib\asyncio\events.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
After some googling I find a lot of tutorial that explain how to install jupyter in you system python then add virtualenvs to it, but not how to install it INSIDE a virtual env.
The reason I did that is because I want my python 3 project to be isolated since I have a lot of python 2.7 projects (up until now I was not using virtualenv and every package is installed in my system python 2.)
Any idea of why I have this exception?
Thanks.
PS : yes it says p38x64_jupytertest3 in the stacktrace because the venv is not p38x64_jupytertest but p38x64_jupytertest3 in fact
know issue : https://github.com/jupyter/notebook/issues/4613
Reverting to python 3.7 for the moment
Related
I'm trying to teach myself to use the beeware briefcase package for Python, although having issues setting it up. I've got pyenv installed, and my local python version in the root of my project is set to 3.8.9. I'm using windows and Powershell
In PowerShell, I've created the python virtual environment, and have installed briefcase via pip.
I've installed git as well, and linked the repo to github.
When I try to run "briefcase new", and go through the prompts, I receive the following traceback (for both powershell and gitbash):
(I've removed my root details in below errors)
Traceback (most recent call last):
File "C:\~\.pyenv\pyenv-win\versions\3.8.9\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\~\.pyenv\pyenv-win\versions\3.8.9\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\~\CodeProjects\beeware-tutorial\.venv\Scripts\briefcase.exe\__main__.py", line 7, in <module>
File "c:\~\codeprojects\beeware-tutorial\.venv\lib\site-packages\briefcase\__main__.py", line 14, in main
command(**options)
File "c:\~\codeprojects\beeware-tutorial\.venv\lib\site-packages\briefcase\commands\new.py", line 537, in __call__
return self.new_app(template=template, **options)
File "c:\~\codeprojects\beeware-tutorial\.venv\lib\site-packages\briefcase\commands\new.py", line 488, in new_app
cached_template = self.update_cookiecutter_cache(
File "c:\~\codeprojects\beeware-tutorial\.venv\lib\site-packages\briefcase\commands\base.py", line 569, in update_cookiecutter_cache
f"Using existing template (sha {head.commit.hexsha}, "
File "c:\~\codeprojects\beeware-tutorial\.venv\lib\site-packages\git\refs\symbolic.py", line 217, in _get_commit
obj = self._get_object()
File "c:\~\codeprojects\beeware-tutorial\.venv\lib\site-packages\git\refs\symbolic.py", line 210, in _get_object
return Object.new_from_sha(self.repo, hex_to_bin(self.dereference_recursive(self.repo, self.path)))
File "c:\~\codeprojects\beeware-tutorial\.venv\lib\site-packages\git\objects\base.py", line 85, in new_from_sha
oinfo = repo.odb.info(sha1)
File "c:\~\codeprojects\beeware-tutorial\.venv\lib\site-packages\git\db.py", line 43, in info
hexsha, typename, size = self._git.get_object_header(bin_to_hex(binsha))
File "c:\~\codeprojects\beeware-tutorial\.venv\lib\site-packages\git\cmd.py", line 1253, in get_object_header
return self.__get_object_header(cmd, ref)
File "c:\~\codeprojects\beeware-tutorial\.venv\lib\site-packages\git\cmd.py", line 1240, in __get_object_header
return self._parse_object_header(cmd.stdout.readline())
File "c:\~\codeprojects\beeware-tutorial\.venv\lib\site-packages\git\cmd.py", line 1198, in _parse_object_header
raise ValueError("SHA could not be resolved, git returned: %r" % (header_line.strip()))
ValueError: SHA could not be resolved, git returned: b''
Not sure how I managed to fix the issue but I uninstalled git version 2.37.1 and installed git version 2.30.2, used GitBash to create a new environment, and installed a briefcase.
Seems to have solved the issue.
I'm trying to do the Flask "Hello World" tutorial and when I do the 'flask run' command on terminal I get the following traceback:
PS C:\Users\boymeetscode\PycharmProjects\beerRPG> flask run
Traceback (most recent call last):
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\Scripts\flask-script.py", line 9, in <module>
sys.exit(main())
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\flask\cli.py", line 990, in main
cli.main(args=sys.argv[1:])
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\flask\cli.py", line 596, in main
return super().main(*args, **kwargs)
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\core.py", line 1062, in main
rv = self.invoke(ctx)
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\core.py", line 763, in invoke
return __callback(*args, **kwargs)
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\core.py", line 763, in invoke
return __callback(*args, **kwargs)
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\flask\cli.py", line 844, in run_command
show_server_banner(get_env(), debug, info.app_import_path, eager_loading)
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\flask\cli.py", line 678, in show_server_banner
click.echo(f" * Environment: {env}")
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\utils.py", line 294, in echo
file = auto_wrap_for_ansi(file) # type: ignore
File "C:\Users\boymeetscode\miniconda3\envs\beerRPG\lib\site-packages\click\_compat.py", line 541, in auto_wrap_for_ansi
import colorama
ModuleNotFoundError: No module named 'colorama'
I am on Windows, Python 3.9.7 and did the pip install flask in my venv so if colorama is a dependency I would expect that it would have been installed automatically. Why isn't it?
Update: I manually installed colorama and now Flask works. I'm just still confused why if this is a dependency it wasn't installed automatically. My pip install didn't appear to return any errors.
Can confirm something in conda or click broke recently: colorama is missing after installing click (which was installed for black in my case). I use conda environment files so instead of manually installing I added a more recent version with
- conda-forge::click
in the .yml file.
Then conda update installed click 8.03 and colorama, over click 8.0.1 which I had. Without an env file conda install -c conda-forge click should do the trick.
I do not know what exactly fixed it though, it is not in click's release notes: though there was arecent change to always install colorama, that was in version 8.0.0.
Hope anyone can help me figure out how to solve.
Here is the message:
Traceback (most recent call last):
File "C:\Users\AA\anaconda3\Scripts\jupyter-lab-script.py", line 9, in
sys.exit(main())
File "C:\Users\AA\anaconda3\lib\site-packages\jupyter_core\application.py", line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Users\AA\anaconda3\lib\site-packages\traitlets\config\application.py", line 844, in launch_instance
app.initialize(argv)
File "C:\Users\AA\anaconda3\lib\site-packages\traitlets\config\application.py", line 87, in inner
return method(app, *args, **kwargs)
File "C:\Users\AA\AppData\Roaming\Python\Python38\site-packages\notebook\notebookapp.py", line 1368, in initialize
self.init_webapp()
File "C:\Users\AA\AppData\Roaming\Python\Python38\site-packages\notebook\notebookapp.py", line 1188, in init_webapp
self.http_server.listen(port, self.ip)
File "C:\Users\AA\anaconda3\lib\site-packages\tornado\tcpserver.py", line 152, in listen
self.add_sockets(sockets)
File "C:\Users\AA\anaconda3\lib\site-packages\tornado\tcpserver.py", line 165, in add_sockets
self._handlers[sock.fileno()] = add_accept_handler(
File "C:\Users\AA\anaconda3\lib\site-packages\tornado\netutil.py", line 279, in add_accept_handler
io_loop.add_handler(sock, accept_handler, IOLoop.READ)
File "C:\Users\AA\anaconda3\lib\site-packages\tornado\platform\asyncio.py", line 100, in add_handler
self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
File "C:\Users\AA\anaconda3\lib\asyncio\events.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
I my opinion there are 2 solutions :
solution 1 :
try to downgrade you Jupyter lab from anaconda navigator .
solution 2:
open your anaconda navigator .
click on jupyter lab setting option and then remove it.
open anaconda prompt and type command conda install -c conda-forge jupyterlab
open anaconda command prompt as administrator
I am struggling with running Jupyter Notebook on PyCharm2018 Community Edition in Windows 10. I created a Virtual Environment with python version 3.6.6 and other necessary packages. I installed jupyter notebook (ipython-7.8.0v, jupyter-1.0.0v) as well following its documentation. As, I am using a specific python version for this application, I want to create a separate ipython kernel (version 5.1.2) for python 3 in a specific path and then add it to jupyter kernelspecs as follows:
ipython kernel install --prefix /tmp
jupyter kernelspec install /tmp/share/jupyter/kernels/python3
When I run an example ipython notebook after following these instructions, the notebook is returning Kernel Error problem stating Could not find a kernel matching Python 2 . I am unable to understand, why its resulting in this. There is no trace of python2 being used anywhere during my installation. I even created python3 kernels separately using above instructions and changed my notebook to kernel to that, but still the same Kernel Error. Virtual Environment I created for this application also uses python3.6 exec file from my Anaconda Installation.
I have looked around similar questions on this problem, but none of them could help me solve this so far. The back trace of this error is as follows.
Traceback (most recent call last):
File "D:\Anaconda3\envs\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "D:\Anaconda3\envs\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\***\pycharm_workspace\trail\venv\lib\site-packages\ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "D:\***\pycharm_workspace\trail\venv\lib\site-packages\traitlets\config\application.py", line 663, in launch_instance
app.initialize(argv)
File "<D:\***\pycharm_workspace\trail\venv\lib\site-packages\decorator.py:decorator-gen-125>", line 2, in initialize
File "D:\***\pycharm_workspace\trail\venv\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "D:\***\pycharm_workspace\trail\venv\lib\site-packages\ipykernel\kernelapp.py", line 472, in initialize
self.write_connection_file()
File "D:\***\pycharm_workspace\trail\venv\lib\site-packages\ipykernel\kernelapp.py", line 199, in write_connection_file
iopub_port=self.iopub_port, control_port=self.control_port)
File "D:\***\pycharm_workspace\trail\venv\lib\site-packages\jupyter_client\connect.py", line 141, in write_connection_file
with secure_write(fname) as f:
File "D:\Anaconda3\envs\python36\lib\contextlib.py", line 81, in __enter__
return next(self.gen)
File "D:\**\pycharm_workspace\trail\venv\lib\site-packages\jupyter_core\paths.py", line 404, in secure_write
win32_restrict_file_to_user(fname)
File "D:\**\pycharm_workspace\trail\venv\lib\site-packages\jupyter_core\paths.py", line 359, in win32_restrict_file_to_user
import win32api
**ImportError: DLL load failed: The specified procedure could not be found.**
Thanks in advance for the help.
I'm trying to run a Jupyter notebook. I installed Anaconda 5.3 with the Python 3.7 version. The notebook starts up, but the Kernel fails to run because it's pointing to another version of Tornado that I've installed for some of my ROS projects (output below). How do I ensure the Jupyter kernel is using Tornado installed in the Anaconda path?
[I 10:56:54.649 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
Traceback (most recent call last):
File "/dir/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/dir/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/dir/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "/dir/anaconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-123>", line 2, in initialize
File "/dir/anaconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/dir/anaconda3/lib/python3.7/site-packages/ipykernel/kernelapp.py", line 467, in initialize
self.init_sockets()
File "/dir/anaconda3/lib/python3.7/site-packages/ipykernel/kernelapp.py", line 260, in init_sockets
self.init_iopub(context)
File "/dir/anaconda3/lib/python3.7/site-packages/ipykernel/kernelapp.py", line 268, in init_iopub
self.iopub_thread = IOPubThread(self.iopub_socket, pipe=True)
File "/dir/anaconda3/lib/python3.7/site-packages/ipykernel/iostream.py", line 66, in __init__
self.io_loop = IOLoop(make_current=False)
File "/dir/ros_projects/forked/rosbridge_suite/rosbridge_server/src/tornado/util.py", line 208, in __new__
instance.initialize(**args)
File "/dir/ros_projects/forked/rosbridge_suite/rosbridge_server/src/tornado/platform/epoll.py", line 26, in initialize
super(EPollIOLoop, self).initialize(impl=select.epoll(), **kwargs)
TypeError: initialize() got an unexpected keyword argument 'make_current'
[W 10:56:57.665 NotebookApp] KernelRestarter: restart failed
[W 10:56:57.666 NotebookApp] Kernel 2dd183ff-850d-4f79-945c-c8f56f1e695e died, removing from map.
A little late, but answering my own question. PYTHONPATH was set for a bunch of other projects. Since conda doesn't set PYTHONPATH, running
unset PYTHONPATH
did the trick.