Local pyenv python version ignored - virtualenv

I want to use Notebook with a previous python version as Pytorch works with 3.8
I have installed 2 python version :
$ pyenv versions
* 3.8.10 (set by C:\Users\Guillaume\Documents\Python\Pegasus Tutorial\.python-version)
3.9.6
I have set 3.8.10 local to my notebook folder as I want to run it with older python version.
Though my notebook cell returns this :
!python --version
Python 3.9.5
When I run python --version inside the folder it returns 3.10.5 and not 3.8.10 as expected

Related

Installing ipython with python 3.5 using pip?

The Jupyter docs recommend using conda to install jupyter, if the runtime python is version 3.5 or lower. Installation is pretty straightforward with conda.
Follow Anaconda’s instructions for downloading and installing the Python 3.5 version.
$ conda install jupyter
$ pip list | grep ipython
ipython 7.29.0
ipython-genutils 0.2.0
$ ipython notebook --ip=0.0.0.0
This question is to discover if it's possible to install a 3.5 compatible jupyter using only pip, and without conda.
Given the following environment:
$ python --version
Python 3.5.2
$ sudo apt-get install python3-pip
$ pip3 --version
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)
Installing ipython is possible with the following restrictions:
$ python3 -m pip install ipython==7.9 traitlets==4.3.3 jedi==0.17.2
Jupyter, however, doesn't install gracefully.
The following allows for installation:
pip3 install jupyter ipython==7.9 traitlets==4.3.3 jedi==0.17.2 pyzmq==20 argon2-cffi==21.1.0
But at runtime, jupyter crashes:
File "/home/vagrant/.local/lib/python3.5/site-packages/ipython_genutils/importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
File "/home/vagrant/.local/lib/python3.5/site-packages/notebook/__init__.py", line 27, in <module>
from .nbextensions import install_nbextension
File "/home/vagrant/.local/lib/python3.5/site-packages/notebook/nbextensions.py", line 15, in <module>
from jupyter_core.paths import (
File "/home/vagrant/.local/lib/python3.5/site-packages/jupyter_core/__init__.py", line 1, in <module>
from .version import version_info, __version__
File "/home/vagrant/.local/lib/python3.5/site-packages/jupyter_core/version.py", line 21
_suffix_ = f'.dev{version_info.serial}'
Is it possible to install a 3.5 friendly jupyter using pip?
Resources
pyzmq https://github.com/jupyter/notebook/issues/5961
iPython Versions
https://github.com/ipython/ipython/blob/master/README.rst
IPython 7.10+ supports Python 3.6 and above.
When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
Python 3.3 and 3.4 were supported up to IPython 6.x.
Python 3.5 was supported with IPython 7.0 to 7.9.
traitlets vs. python 3.5
Traitlets 5 uses f-strings in code, not compatible with Python 3.5
uninstall the traitlets 5.0.3 version, and install 4.3.3 version
https://githubmemory.com/repo/ipython/traitlets/issues/620
argon2-cffi vs. python 3.5
https://packagegalaxy.com/python/argon2-cffi
It targets Python 3.6 and newer, and PyPy3.
The last version that works with Python 2.7 is 20.1.0, and the last version that works with Python 3.5 is 21.1.0.
jedi vs. python 3.5
https://jedi.readthedocs.io/en/latest/docs/changelog.html
0.17.2 (2020-07-17)
This will be the last release that supports Python 2 and Python 3.5. 0.18.0 will be Python 3.6+.

pyenv set local python for a project

I can't seem to be able to set local python for a project, not even global python.
$ pyenv local 3.9.6
$ pyenv global 3.9.6
$ pyenv versions
system
* 3.9.6 (set by /home/cmap/c-map/.python-version)
In .python-version it is written 3.9.6
But when I type python -V I get 3.7.3 which is the original system installed python
What am I missing here?
I finally found what was missing. Had to add the following to .profile
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"

TensorFlow works in command prompt but doesn't work in spyder( ipython)

My spyder version is 3.3.4 in anaconda( version 3.5), and my Ipython version is 7.4.0. Now my python version is 3.7.3 and I installed tensorflow of 1.13.1 version. When I open spyder and input the commands "import tensorflow as tf ",it is always running and I can not use function of tf. But I can use tensorflow in python through command prompt, I'm just not used to editing function in command prompt. So I want to know what is the reason that tensorflow doesn't work in spyder while running well in command prompt.

Why the - pyenv: no such command 'shell' error

This seems pretty basic so why the no such command error:
$ pyenv shell
pyenv: no such command `shell`
https://github.com/pyenv/pyenv/blob/master/COMMANDS.md#pyenv-shell
pyenv shell switch your python locally (current shell session) to a specific version. You should run it by following the version you've already instlled.
To check the current python you are using and the versions installed:
pyenv version #return the version you are using
pyenv versions # return all versions installed
You can then set the python version for your current shell session
pyenv shell 3.6.4 #3.6.4 is one of the installed python version

How do I install Scala in Jupyter IPython Notebook?

Here's a few links that I went to and did exactly what they said. I don't know what I'm doing wrong.
https://github.com/alexarchambault/jupyter-scala
https://github.com/ipython/ipython/wiki/IPython-kernels-for-other-languages
https://github.com/apache/incubator-toree
http://jcrudy.github.io/blog/html/2013/12/08/introduction_to_iscala.html
None of this is working. It may be some way that my node is configured. I just don't know. Please help.
I tried the following with Jupyterhub notebook and it works seamlessly:
# Step 1: Install spylon kernel
pip install spylon-kernel
# Step 2: create a kernel spec
python -m spylon_kernel install
# Step 3: start jupyter notebook
jupyter notebook
PS: to list all installed kernels, you can run the following command:
jupyter kernelspec list
You can use the information given here.
Ensure you have IPython 3 installed. ipython --version should return a
value >= 3.0. If it's not the case, a quick way of setting it up
consists in installing the Anaconda Python distribution, and then
running
$ pip install --upgrade "ipython[all]"
ipython --version should then return a value >= 3.0.
Download the Jupyter Scala binaries for Scala 2.10 (txz or zip) or
Scala 2.11 (txz or zip), and unpack them in a safe place. Then run
once the jupyter-scala program (or jupyter-scala.bat on Windows) it
contains. That will set-up the Jupyter Scala kernel for the current
user.
Check that Jupyter/IPython knows about Jupyter Scala by running
$ jupyter kernelspec list
This should print, among others, a line like
scala211
(or scala210 dependending on the Scala version you chose).
Then run either IPython console with
$ ipython console --kernel scala211
and start using the Jupyter Scala kernel straightaway, or run Jupyter
Notebook with
$ jupyter notebook
and create Scala 2.11 notebooks by choosing Scala 2.11 in the dropdown
in the upper right of the Jupyter Notebook start page.
Note: Since IPython has now been replaced by Jupyter, we replaced ipython in the above commands with jupyter.
I've just run:
conda create --name base2 --clone base to create an env just like base.
conda activate base2 to move to the new env.
conda install -c conda-forge spylon-kernel.
python -m spylon_kernel install --user. create a kernel spec for Jupyter notebook
jupyter-notebook
...and works just fine.
I'm using:
Anaconda 4.7.12
Jupyter-notebook 6.0.1
Ubuntu 18.04
ipykernel 5.1.3
ipython 7.9.0
ipython_genutils 0.2.0
jupyter_client 5.3.4
jupyter_core 4.6.0
traitlets 4.3.3
from def suma(a: Int) = a + 3
I can't add a comment to Heapify's answer, but his solution worked for JupyterLab on Windows without problems.
I cut and pasted his code into an Anaconda Powershell prompt
pip install spylon-kernel
python -m spylon_kernel install
jupyter notebook
And refreshed my anacopnda launcher and the spylon project option was available.
The answer for Linux can be found here.
Install Scala. Add these lines to ~/.bashrc
export SCALA_HOME=/usr/local/share/scala export
PATH=$PATH:$SCALA_HOME/bin:$PATH
Follow these instructions from the
GitHub site:
Download and unpack pre-packaged binaries Scala 2.11. Unpack each
downloaded archive(s), and, from a console, go to the bin
sub-directory of the directory it contains. Then run the following to
set-up the corresponding Scala kernel:
./jove-scala --kernel-spec
Make sure spark is installed in local along with SPARK_HOME is added or exported in .profile/environment file.
If not, you might get stuck with the following message:
"Intitializing Scala interpreter ..."
without any result.
For mac, I needed only to 3 commands to add Scala and run it with Spark (I had it already installed) on my Jupyter notebook
pip install spylon-kernel
python -m spylon_kernel install
ipython notebook
Once you run them on your terminal, you'll have spylon-kernel in your notebook, which can be used as your a Scala notebook.
spylon-kernel hasn't seen an update in years. These days its much better to use almond.