Name error and syntax error when trying to activate jupyterthemes - jupyter-notebook

I am new to Python and Jupyter Notebook (with Anaconda), so bear with me if the answer to this is obvious.
I would like to change my Jupyter Notebook to dark mode. There are a lot of tutorials out there to do so with jupyter-themes, e.g. here. They are straight forward, and all say exactly the same thing, but it simply does not work for me.
When I'm in Jupyter Notebook, installing the themes either with
conda install -c conda-forge jupyterthemes or
pip install jupyterthemes seem to work just fine. However, the following commands will give me the following errors.
jt -l will return
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Input In [5], in <cell line: 1>()
----> 1 jt -h
NameError: name 'jt' is not defined
and
jt -t chesterish will give
Input In [89]
jt -t chesterish
^
SyntaxError: invalid syntax
Same story for any other theme. Any idea what I'm doing wrong? Should I enter the code somewhere else that I'm not aware of?
Either way, thanks in advance and cheers!

If you're in the notebook, try adding an exclamation point before any jt call: !jt -l.
If you change the theme like !jt -t chesterish you'll have to restart jupyter notebook for the change to take place, though. Otherwise, you should be able to do the command without the exclamation point in the anaconda prompt. Hopefully this works! Cheers.

Related

How could I delete nuitka logs?

I was using what was nuitka to compile my Python codes, the problem is the annoying (logs / warning) that shows, I have tried with everything but nothing works, I would like to know how to solve this. Any ideas?
Extra: it is not worth using the typical 2>&1, 2>/dev/null, >nul
os.system("nuitka {} -o {} --output-dir={} --quiet --remove-output".format(...))
Github of nuitka

julia command not found even after adding to PATH

I am not able to run a Julia file from the command line despite being able to use Julia fine from inside the REPL and Atom. I receive a zsh: command not found: julia error when I try that. Based on this resource, I ran export PATH="/Applications/Julia-1.4.2.app/Contents/Resources/julia/bin:$PATH" and sudo ln -s /Applications/Julia-1.4.2.app/Contents/Resources/julia/bin/julia /usr/local/bin/julia but it did not resolve the issue. Is there anything else I could try?
edit: I am running macOS Catalina 10.15.5
ls -a /Applications/ showed that the file is actually named Julia-1.4.app

How to fix asdf error when using buildapp on a quicklisp project

I've been making my first quicklisp project lately and I wanted to share it. I've put it on github, but not everyone has emacs + slime + quicklisp installed so I wanted to make an executable I could put with the code.
To do this I'm using buildapp and following the steps laid out in this stackoverflow answer.
$ sbcl --no-userinit --no-sysinit --non-interactive \
--load ~/quicklisp/setup.lisp \
--eval '(ql:quickload "ltk-colorpicker")' \
--eval '(ql:write-asdf-manifest-file "quicklisp-manifest.txt")'
$ buildapp --output out \
--manifest-file quicklisp-manifest.txt \
--load-system ltk-colorpicker \
--entry colorpicker
After running those commands I get the following error:
Fatal INPUT-ERROR-IN-LOAD:
READ error during LOAD:
The symbol "*SYSTEM-DEFINITION-SEARCH-FUNCTIONS*" is not external in the ASDF/FIND-SYSTEM package.
Line: 16, Column: 90, File-Position: 15267
Stream: #<SB-INT:FORM-TRACKING-STREAM for "file /home/nathan/quicklisp/local-projects/ltk-colorpicker/dumper-2SKVI5f7.lisp" {1001B70F83}>
The main problem here is that I don't even have a clue at how to begin to fix it. I've seen this gibhub issue, but that had to do with problems with Homebrew and it never even mentions buildapp. It's all very confusing. And I hope I could get some help.
Thanks in advance for any answers.
I can reproduce the error. As suggested in the comments, you can build an up-to-date version of buildapp as follows:
$ sbcl
* (ql:quickload :buildapp)
...
* (buildapp:build-buildapp
(merge-pathnames "bin/buildapp" (user-homedir-pathname)))
This build $HOME/bin/buildapp. When I use the new binary, there is no error anymore.
You can also avoid generating an executable (that can end up being outdated) by systematically calling the buildapp::main function from Common Lisp; you will then always have the version that corresponds to the current release of quicklisp:
* (buildapp::main
'("BUILDAPP" ;; argv[0] must exist but the value is not important
"--manifest-file" "/tmp/quicklisp-manifest.txt"
"--load-system" "drakma" "--output" "/tmp/test"))
Some extra info from my point:
The solution was to use the newest version of buildapp as #coredump mentioned. I updated by going to the github page, downloading the zip and doing the following commands at the point where buildapp is stored.
$ make
$ cp buildapp /usr/bin
(This of course only works on linux.)
This is not an elegant solution but buildapp hasn't updated in 4 years, I think it's a safe enough bet. I also made a mistake with the command. The --entry part is wrong. It should have been: `--entry ltk-colorpicker::main`` where main is a function that takes one variable since that's required by the spec.
Main is just this: (main (i) (declare (ignore i)) (colorpicker))

Opening the atom editor from iTerm2 window is displaying - 'zsh: command not found: atom'

Just installed iTerm2 with oh-my-zsh, with atom already installed..
I have cloned a git repo of mine to use on an older laptop and for some reason oh-my-zsh is not opening my atom on the usual command.
➜ LandingPage git:(master) atom .
zsh: command not found: atom
Tried rectifying it by accessing and changing the .zshrc file but permission is denied. Anyone any suggestions?
Thanks,
Ant
As per this question/answer it looks like atom may not have created a symlink to the atom command.
This has nothing to do with zsh -- the first argument is just telling you the shell, the information after it is the error.
For example on my machine (which doesn't have atom) when running zsh and trying to open a file with atom I get zsh: command not found: atom. When I try the same command with bash, I get bash: atom: command not found.
Let me know if the above link doesn't work! Hopefully this helps.

TAB completion does not work in Jupyter Notebook but fine in iPython terminal

TAB completion works fine in iPython terminal, but not in Firefox browser.
So far I had tried but failed,
1). run a command $ sudo easy_install readline,
then the .egg file was wrote in /usr/local/lib/python2.7/dist-packages/readline-6.2.4.1-py2.7-linux-x86_64.egg,
but TAB completion still doesn't work in Jupyter Notebook.
2). also tried to find locate the ipython_notebook_config.py or ipython_config.py, but failed.
I use Python 3.5 and iPython 4.0.0. and both are installed in Ubuntu 15.10 /usr/share/anaconda3/bin/ipython.
Any help would be appreciated!
It's a known issue and jedi is the problem. Try executing:
pip3 install jedi==0.17.2
https://github.com/jupyter/notebook/issues/2435
My problem was in that I try to call autocomplete and import in the same cell.
Because of imported thing does not initialized yet, autocomplete does not work.
All I need is call to the object in a new cell
UPD: or just run program once in the same cell to initialize imported
I've just installed the latest JEDI then helped me to solve that issue, here's the command when using Anaconda:
conda install -c anaconda jedi
Or you might need to try this, copy this line on the top of your jupyter notebook:
%config Completer.use_jedi = False
%config Completer.use_jedi = False
This command helps but we need to add it to all the notebooks again and again.
you can add
%config IPCompleter.greedy=True
in the first box of your Jupyter Notebook.
I had a similar issue and unfortunately cannot comment on a post, so am adding an easy solution that worked for me here. I use conda and conda list showed I was running jedi-0.18.0. I used the command conda install jedi==0.17.2. This quickly fixed the problem for my conda environment.
Additional note: I usually use jupyter-lab, and was not seeing the error messages generated. By switching to jupyter notebook, I saw the following error:
[IPKernelApp] ERROR | Exception in message handler: Traceback (most
recent call last): File
"D:\apps\miniconda\envs\pydata-book\lib\site-packages\ipykernel\kernelbase.py",
line 265, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg)) File "D:\apps\miniconda\envs\pydata-book\lib\site-packages\tornado\gen.py",
line 762, in run
value = future.result() File "D:\apps\miniconda\envs\pydata-book\lib\site-packages\tornado\gen.py",
line 234, in wrapper
yielded = ctx_run(next, result) File "D:\apps\miniconda\envs\pydata-book\lib\site-packages\ipykernel\kernelbase.py",
line 580, in complete_request
matches = yield gen.maybe_future(self.do_complete(code, cursor_pos)) File
"D:\apps\miniconda\envs\pydata-book\lib\site-packages\ipykernel\ipkernel.py",
line 356, in do_complete
return self._experimental_do_complete(code, cursor_pos) File "D:\apps\miniconda\envs\pydata-book\lib\site-packages\ipykernel\ipkernel.py",
line 381, in _experimental_do_complete
completions = list(_rectify_completions(code, raw_completions)) File
"D:\apps\miniconda\envs\pydata-book\lib\site-packages\IPython\core\completer.py",
line 484, in rectify_completions
completions = list(completions) File "D:\apps\miniconda\envs\pydata-book\lib\site-packages\IPython\core\completer.py",
line 1815, in completions
for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000): File "D:\apps\miniconda\envs\pydata-book\lib\site-packages\IPython\core\completer.py",
line 1858, in _completions
matched_text, matches, matches_origin, jedi_matches = self._complete( File
"D:\apps\miniconda\envs\pydata-book\lib\site-packages\IPython\core\completer.py",
line 2026, in _complete
completions = self._jedi_matches( File "D:\apps\miniconda\envs\pydata-book\lib\site-packages\IPython\core\completer.py",
line 1369, in jedi_matches
interpreter = jedi.Interpreter( File "D:\apps\miniconda\envs\pydata-book\lib\site-packages\jedi\api_init.py",
line 725, in init
super().init(code, environment=environment, TypeError: init() got an unexpected keyword argument 'column'
I highlighted a couple of the jedi messages, but this all reinforced it was a problem related to the version of jedi installed.
In my case, after running pip install pyreadline, I needed to re-execute all the lines in Jupyter before the completion worked. I kept wondering why it worked for IPython but not Jupyter.
In my case I installed miniconda on Debian Linux and most likely had a problem with the previous Python that was included with Debian. The following lines solved my problem:
conda update conda
conda update --all
The solution was taken from here based on the error that I had in IPython in terminal after writing np.<tab>:
No such file or directory: '/home/user/miniconda3/lib/python'
The answer from Sagnik above (Dec 20, 2020) works for me on Windows 10.
pip3 install jedi==0.17.2
[Sorry I'm posting this as an answer instead of comment. I have no permission to comment yet. ]
The workaround I found is to assign the intermediate result to a temporary variable.then in seperate cell, using tab on temporary variable for auto-completion.
temp = pd.Description
temp.TAB
I had the same issue, resolved using
conda install -c anaconda jedi
I had the same issue under my conda virtual env in windows pc and downgrading the jedi to 0.17.2 version resolved the issue for me.
conda install jedi==0.17.2
faced the same problem, for me the following worked
conda install -c anaconda jedi
The best fix I've found for this issue was to create a new Environment. If you are using Anaconda simply create a new environment to fix the issue. Sure you have to reinstall some libraries but its all worth it.
F.wo.huang's comment on the OP worked for me in my anaconda environment:
condo update readline
Creating a new env variable helped me to solve this problem.
Use environments.txt content in .conda as path.
I had the same issue when I was using miniconda,
I switched to anaconda and that seems to have solved the issue.
PS. I had tried everything I could find on the net but nothing resolved it except for switching to anaconda.
As the question was asked five years ago, the answer was likely different back then... but I want to add my two cents if anyone googles today: The answer by users Sagnik and more above worked for me.
One thing to add is that if running anaconda, you can do what I did: simply
start the anaconda-navigator software,
locate the jedi package in my environment,
click the little checkbox on the right of jedi
under "Mark for specific version installation", choose 0.17.2
After restarting the kernel everything worked :)
Try the command below as discussed here
pip install -U ipython==7.20

Resources