How do I get the IPython version I'm currently using?
I'm aware of sys.version, but that's the Python version I'm currently using.
Edit: And I'm aware of ipython --version, but I want to check inside the current IPython session. !ipython --version doesn't work for me cause I might have multiple IPython versions installed.
You can import IPython, then use IPython.version_info to get it as a tuple, or IPython.__version__ to get it as a string. For example:
In [1]: import IPython
In [2]: IPython.version_info
Out[2]: (4, 1, 2, '')
In [3]: IPython.__version__
Out[3]: '4.1.2'
IPython.version_info seems to be the same layout as sys.version_info: major, minor, micro, releaselevel.
Run the following command in the terminal:
ipython --version
Related
I encountered an import problem by PyAudio.
I have a winodws 10, 64 bit, and use Anaconda and Spyder IDE with python 3.7.
I installed PyAudio in Ananconda, ran as administrator, with these commands :
cd
conda install -c conda-forge PyAudio
The installation ran without any problems.
I then restarted both Anaconda and SPYDER. PyAudio now shows up in Anaconda's list of installed packages.
When I try to import Pyaudio in Spyder (IPython console), I encounter this error message :
[1]: import pyaudio
Could not import the PyAudio C module '_portaudio'.
Traceback (most recent call last):
File "", line 1, in
import pyaudio
File "C:\ProgramData\Anaconda3\lib\site-packages\pyaudio.py", line 116, in
import _portaudio as pa
ImportError: DLL load failed: The specified module could not be found.
I tried to fix it by answers to similar ImportError message issued, while other users tried to import other packages like SKlearn ... , but with no success.
Your problem (and mine) are the same. The issue is, unfortunately, the version of python you're running (in tandem with your OS).
Check out this link:
https://people.csail.mit.edu/hubert/pyaudio/#:~:text=Note%3A%20As%20of%20this%20update,4.
Under the INSTALLATION section in the link for WINDOWS, PyAudio's latest version (0.2.11) is compatible with Python versions: 2.7, 3.4, 3.5, 3.6.
My current python is 3.8.5, so you (and I) could never use PyAudio unless they added compatibilities or we revert to an above python version.
I tried to install portaudio using
conda install portaudio
but it seems like it didn't work as it should be. However,
conda install -c anaconda portaudio
solved the problem.
see the official anaconda page
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.
Setup: MacOS High Sierra, Spyder 3.3.1, Python 2.7.15 64bits, Qt 5.9.4, PyQt5 5.9.2 on Darwin
I run the following code in the IPython console within Spyder:
In [1]: import os
In [2]: os.system("ls")
Out[2]: 0
In [3]: os.system("aasdasd")
Out[3]: 32512
I can see the output to stdout of the ls command in the bash shell where I run spyder, but not to stderr of the second os.system call that should print sh: asdasd: command not found.
Where does spyder redirect stderr to? Is there a way to see error messages like the one generated in the second case?
Thank you very much!
(Spyder maintainer here) This was fixed in spyder-kernels 0.3.0, the package that provides kernels for our consoles. And by fixed I mean that both stdout and stderr of external commands are now shown directly in our IPython consoles.
To update spyder-kernels, please close Spyder and run in a system terminal (xterm or Terminal.app, this doesn't work on Windows):
conda install spyder-kernels=0.*
if you use Anaconda (it's not available at the moment, but it should be shortly, please wait until it is), or
pip install spyder-kernels==0.*
if you use a custom Python installation.
If I invoke ipython and ipython3, both show exactly the same message:
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.
Is not it that ipython shows something like Python 2?
How can I make ipython use Python 2?
IPython 6+ requires Python 3.3+, so that's what it defaults to, and it will not open Python 2.x.
From the 6.x Series page in the IPython docs:
Important
This documentation covers IPython versions 6.0 and higher. Beginning
with version 6.0, IPython stopped supporting compatibility with Python
versions lower than 3.3 including all versions of Python 2.7.
If you are looking for an IPython version compatible with Python 2.7,
please use the IPython 5.x LTS release and refer to its documentation
(LTS is the long term support release).
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.