simple question:
does different notebooks in google colab share the same package?
I run !pip list, and I want to find Kora, which is a module that I just installed by !pip Kora.
As you can see, I can find kora from one notebook, but can't find it in another notebook. Why?
You will need to install it each time in every new notebooks.
Related
what that mean when i get the below error in google colab ?
File "", line 1
coding pyton in google colab and i was imorting the libraries
and it give me this error
Most likely you need to install the libraries before importing them. You can do this by using a different code cell. An example below for selenium:
!pip install selenium
Use this line and replace selenium with the library you need and run the code-cell.
After this the code should run without errors.
Fist of all, you need to show the Error you got.
But maybe you haven't installed the Packages, that's why you got error while Importing.
So you need to install the Packages using " pip install "
I am trying to use the tensorflow_federated library in google colab but cannot figure out how to do this. I have searched a lot on the internet for the same, but everywhere it's given, you don't need to install this library in google colab and you can use it directly, but I am not able to do so. Can anyone who has used this library in google colab tell me how to install/directly use it?
In the TensorFlow Federated Tutorials Overview there are links to 10+ colab notebooks. Navigating to any of them, and then clicking on Run in Google Colab should open the notebook in colab and demonstrates how to use.
Notably, TensorFlow Federated is not installed by default in Google Colab, rather all of the notebooks start with the following cell:
!pip install --quiet --upgrade tensorflow-federated
!pip install --quiet --upgrade nest-asyncio
import nest_asyncio
nest_asyncio.apply()
which installs TensorFlow Federated, as well as the nest-asyncio package which is needed for TensorFlow Federated's use of asyncio inside the event loop of colab itself.
Is there a way to install Rapids permanently on Google colab? I tried many solutions given on StackOverflow and other websites but nothing is working. This is a very big library and it is very frustrating to download this every time I want to work on colab.
I tried this code from Rapids but it is also not working. When I close colab and start again later, I get ModuleNotFoundError: No module named 'cudf'.
# Install RAPIDS
!git clone https://github.com/rapidsai/rapidsai-csp-utils.git
!bash rapidsai-csp-utils/colab/rapids-colab.sh stable
import sys, os, shutil
sys.path.append('/usr/local/lib/python3.7/site-packages/')
os.environ['NUMBAPRO_NVVM'] = '/usr/local/cuda/nvvm/lib64/libnvvm.so'
os.environ['NUMBAPRO_LIBDEVICE'] = '/usr/local/cuda/nvvm/libdevice/'
os.environ["CONDA_PREFIX"] = "/usr/local"
for so in ['cudf', 'rmm', 'nccl', 'cuml', 'cugraph', 'xgboost', 'cuspatial']:
fn = 'lib'+so+'.so'
source_fn = '/usr/local/lib/'+fn
dest_fn = '/usr/lib/'+fn
if os.path.exists(source_fn):
print(f'Copying {source_fn} to {dest_fn}')
shutil.copyfile(source_fn, dest_fn)
# fix for BlazingSQL import issue
# ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /usr/local/lib/python3.7/site-packages/../../libblazingsql-engine.so)
if not os.path.exists('/usr/lib64'):
os.makedirs('/usr/lib64')
for so_file in os.listdir('/usr/local/lib'):
if 'libstdc' in so_file:
shutil.copyfile('/usr/local/lib/'+so_file, '/usr/lib64/'+so_file)
shutil.copyfile('/usr/local/lib/'+so_file, '/usr/lib/x86_64-linux-gnu/'+so_file)
A solution has been suggested but which uses pip to install libraries - How do I install a library permanently in Colab? but Rapids can't be installed using pip. It can only be installed using Conda. This is the code to install it.
conda create -n rapids-0.19 -c rapidsai -c nvidia -c conda-forge \
rapids-blazing=0.19 python=3.7 cudatoolkit=11.0
I tried to include the google drive path(nb_path) to this code using the --prefix flag as suggested by the above link !pip install --target=$nb_path jdc but I am getting a syntax error.
Can anyone tell me how to set this nb_path to the conda create code above?
For reference, the conda target path for RAPIDS install is /usr/local. We use a different location in the RAPIDS-Colab install script to get it to work.
At the moment, I'm not aware of any way for a user to permanently install RAPIDS into Google Colab. Google Colab isn't designed for the purpose of persisting libraries - or any data for that matter- that aren't preinstalled in the environment. While you have a decent looking workaround there for pip libraries and datasets with Google Drive mounting, with RAPIDS, it is a little more tricky as we update quite a bit of the Colab environment in order to get it to even install RAPIDS. What you propose is an interesting path to explore. We do encourage and work with RAPIDS community members in our Slack channel who try new methods and improve some of our community code like the RAPIDS-Colab installation script.
Just remember, the RAPIDS + Google Colab effort was never meant to be more than a fun, easy way to "Try RAPIDS out". For Google Cloud users, GCP is supposed to be the next step. While it's heartening to see the usage grow over time, Google would need to create a Colab instance that has RAPIDS preinstalled for what you want to happen. You should let the know you want this by
Open any Colab notebook
Go to the Help menu and select ”Send feedback...”
In the meantime, if you need a ready-to-go instance, there are some inexpensive, RAPIDS-enabled, quick start options on the horizon.
I got a problem I can't seem to figure out. The first time I imported Spacy into a Jupyter notebook I had no problems. It just imported it as I expected.
The second time I tried to import it (using a different notebook) I got:
ImportError: cannot import name 'prefer_gpu' from 'thinc.api' (C:\python-environments\nlp\lib\site-packages\thinc\api.py)
So I tried to restart the kernel and tried it again (thinking that might be the issue). That did not solve it. Also trying to run the same cell that imported Spacy in the first notebook also throws the error now after it went well the first time.
It sounds like you have an old version of Thinc somewhere; try uninstalling and reinstalling Thinc.
Another thing to check is if you're running in the right Python environment. Sometimes Jupyter notebooks pull in a different environment than the one you're expecting in non-obvious ways. There was a thread in spaCy discussions about this recently. You can run this command to check which Python executable is being used in the notebook and make sure it's the one you think it is:
import sys
print(sys.executable)
I had a similar issue, followed the git hub link, created a new environment, and installed all required packages, and it resolved my issue. I'm using Visual code, so I had to install other dependencies since VC uses this as a conda environment as a base for my code implementation
Hey there. So I'm trying to learn Python for data manipulation. Obviously pandas is needed. I am using Windows 10 and have installed Jupyter through the console. I have had no problem getting into the jupyter notebook on my localhost and running basic commands like print. However, I cannot use pandas for some reason. Any guidance of where to look would be appreciated.
Is this a new kernel? If so, !pip runs pip using the system environment, not the kernel environment. Delete the ! at the beginning.