convoluted

Using J-lang in Jupyter

This is a guide on how to run J inside Jupyter Notebook. It is necessary because the official sources are not always well maintained or straightforward. And it took me more time than it should to figure this out. So I am writing this out to save time of strangers in the internet and my future self, of course!

But before I go into all that, let me speak a few words. If you are not interested, jump straight to the guide.


As someone working in Deep Learning, I do all my professional work in Python, and that suffices- more than enough.

And that leaves me with all the (free) time to tinker with whichever language that I please.

I fell in love with J as soon as I was introduced to it. I liked it much more than APL because it requires learning all the glyphs. Some people argue that you learn the notation in Math. True. But I take into account the Return of Investment or RoI. Learning Math notation since the start of my student life till up to my Master's degree in CS- it has served me extremely well. It has literally changed my life. All the possible returns of learning APL notations combined- cannot even come close to that.

So, why bother with J? If I want to do something practical, I have batteries-included languages with myriad of libraries such as Python and JavaScript.

I want the array-language enlightenment.

And for that only, I want to properly learn J. And probably solve some puzzles with it.

And J is all in ASCII, so, I don't need to bother myself with learning glyphs just for the sake of learning an array-based language.

I have wanted to say these for a long time.

Now to the guide!


  1. Install miniconda/Anaconda if it is not already installed in your system. Then create a new conda environment.
conda create -n jlang

Wait till the environment has been created. Activate the environment:

conda activate jlang
  1. Next, go over to the Downloads page of JSoftware website.

Then choose the version. You should use the one that is marked as release. For me, in July 2023, it is 9.4. So I choose that.

I am using Linux, so I will choose the zip files for all systems other than Windows.

I downloaded the file named j9.4_linux64.tar.gz.

  1. You can extract this tarball wherever you choose to. I extracted it to /usr/local. It creates a folder j9.4 there.
tar -xzvf j9.4_linux64.tar.gz -C /usr/local

You can now launch the J console right from your terminal if you navigate to your installation folder and run:

jconsole.sh
  1. Add the extraction folder to PATH. I added a line to the ~/.bashrc file:
export PATH=$PATH:/usr/local/j9.4

Now you will able to run the J console from anywhere.

  1. Add additional packages including the J IDE.
load 'pacman'
'install' jpkg '*'
exit 0

The second line will run for around a minute (or more depending on your internet connection)

The lat two steps were found in the zips page.

  1. Install jupyter in the environment that you created.
conda activate jlang
conda install jupyter
  1. Clone the jkernel repository to a folder of your choice.
git clone https://github.com/martin-saurer/jkernel
  1. From the desired conda environment, run the setup file.
python setup.py install

This should work in most cases, but not for me. I opened an issue that is still open.

  1. So, I downloaded a JDemo folder from this FTP(?) folder.

And I extracted it, and ran the file jupyter-notebook.sh.

It opens up a Jupyter Notebook instance on a browser window, and J code can be run well. I found about it in the guide page.


So far, so good. I haven't faced any problem yet. Let's see! :)

#array #guide #j-lang #tutorial