Comments (14)
Thank you very much @mspronesti for the support!
from lambeq.
Hello,
the problem you see refers to the fact that !pip install lambeq
on Google Colab installs lambeq 0.1.2, which is an old version. You can check this by running
!pip list | grep lambeq
In addition, Colab has python 3.7.13, while you need at least python 3.8
To install latest lambeq, update python first
!sudo apt-get update -y
!sudo apt-get install python3.9
Then change alternatives
#change alternatives
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2
and run
!sudo apt-get install python3.9-distutils && wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py
Eventually, check you python version is 3.9.X
!python --version
If everything went smooth, install lambeq
!pip install lambeq==0.2.6
Anyway making things work on colab might be quite painful when you need packages requiring python 3.8 or above. If the above steps don't work for you, consider having a look here
from lambeq.
Hi, as mentioned by @mspronesti, if you can't find Bobcat in lambeq it means you are using a version < 0.2.0. Please upgrade to the latest version.
from lambeq.
@mspronesti Thank you for your prompt answer! Really appreciate it
I did update my python version, as per this discussion. I also tried your solution of updating the version of lambeq and I still get the same error:
ModuleNotFoundError: No module named 'lambeq'
Anyway making things work on colab might be quite painful when you need packages requiring python 3.8 or above. If the above steps don't work for you, consider having a look here
Maybe I should switch to using Jupyter notebook instead. The circuit visualisations don't appear in my native terminal or Visual Studio Code. Also, the link you posted here redirects me to my own question. Not sure if that was intentional, but a good example of unintented recursion xD
from lambeq.
@alt-shreya My bad, I forgot the URL in the parentheses. Just fixed it, hope it helps!
from lambeq.
@mspronesti tried this fix, but I got this error:
ModuleNotFoundError: No module named 'pyngrok'
which other environments can I run this in?
from lambeq.
Hi @mspronesti,
There are some problems with google colab due to the preinstalled python version (3.7). It is not very straight forward to update the interpreter version of colab, therefore I suggest that host your own runtime (preferably using jupyter notebook), where you have full control over the python version.
from lambeq.
@Thommy257 , I tried running this on Jupyter notebook as well. I get the same error and I am not sure how to proceed.
from lambeq.
Can you check the python version?
from lambeq.
lambeq>=0.2.0
requires python>=3.8
from lambeq.
it's python 3.9 :(
from lambeq.
Hi @alt-shreya,
I think you skipped one or two steps, that's why it doesn't work for you. Please follow the steps below and let me know if it solves your problem.
Step 0
Create a new notebook (on your machine, not on Colab) and edit its metadata with your favorite editor, e.g. vim. You only need to locate the kernelspec
cell, and update its entries like this
"kernelspec": {
"display_name": "Python 3.9",
"name": "py39",
}
Now save it and upload it to Colab.
Step 1
Copy the following code in the first cell of your notebook and run it
!wget -O mini.sh https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh
!chmod +x mini.sh
!bash ./mini.sh -b -f -p /usr/local
!conda install -q -y jupyter
!conda install -q -y google-colab -c conda-forge
!python -m ipykernel install --name "py39" --user
now refresh your browser window (Ctrl + R).
Step 2
Without rerunning the first cell (actually you can even delete it now), run the following one
import sys
sys.version
If the output is
3.9.1 (default, Dec 11 2020, 14:32:07) \n[GCC 7.3.0]
then you successfully updated the kernel on Google Colab.
Step 3
Finally test lambeq works
!pip install lambeq
import lambeq
print(lambeq.__version__)
from lambeq import BobcatParser
parser = BobcatParser()
diagram = parser.sentence2diagram('This is a test sentence')
diagram.draw()
from lambeq.
@mspronesti thank you for the clear walkthrough!
This soultion works and I was able to train a classical case using the tutorial!
from lambeq.
@alt-shreya Glad it worked! 😁 I guess this issue can be closed now.
from lambeq.
Related Issues (20)
- Method or class for composing more than 1 free wires into one HOT 1
- Add more tutorials and example notebooks in the documentation HOT 2
- Ansatz for performing amplitude encoding - Enhancement HOT 4
- Bobcat fails with extra space tokens HOT 3
- BobCat fails to parse with extra addition of "the" to a sentence. HOT 2
- lambeq pytest: No module named lambeq.version HOT 2
- IQPAnsatz: shape error as changing number of qubits for atomic types HOT 4
- Lambeq installation Error HOT 2
- Error whem training Classical Pipeline with Spider Ansatz HOT 4
- Key error in Accuracy function HOT 2
- PicklingError HOT 6
- Anastz Customization HOT 5
- TypeError when construct quantum circuits for multi-classification task HOT 11
- Python 3.12 Type Error in Mac Environment when Loading Library HOT 5
- PennyLane training problem HOT 2
- parameterization tutorial example failing HOT 5
- Implement ASCII drawing for all lambeq diagrams HOT 2
- Improve RemoveCupsRewriter
- Add frames in lambeq HOT 1
- Make PytorchModel work with quantum circuits HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lambeq.