So basically, I am using a package online that requires the use of the shell in order to parse data. The line of code that needs to be sent to the shell is as follows:
python scripts/extract.py esm2_t33_650M_UR50D data/output.fasta data/output_esm --repr_layers 33 --include per_tok
Where extract.py contains a Python script that needs to be run.
In order to achieve this, I had to utilize the ! in the code cell in order to send the line of code to the shell.
However, running the code cell returned an invalid syntax error:
File "scripts/extract.py", line 79
print(f"Read {args.fasta_file} with {len(dataset)} sequences")
^
SyntaxError: invalid syntax
Looking online, it seemed this was caused by the f"" functionality not being available in Python 2.x versions. Which is weird since I am currently running Jupyter on Python 3.8.13.
So I checked the version of Python through the shell and realized it was still running on Python 2.7.17
How do I tell the shell explicitly to use Python 3.x interpreter and packages instead of 2.x? I was always under the assumption that the shell would use the same version of Python that Jupyter is running on.
Thank you!
%runmagic, see here. In fact you can insure it even runs in the same namespace as the current notebook by adding the-iflag. So that any variables you've assigned in the current running notebook will be accessible by the script. This is very helpful when developing a script or debugging. About your assumption, see the second paragraph ...piporconda, see here.