import osmnx on google colab give me an error - python

I'm trying to import osmnx on google Colab and it did install successfully using !pip install osmnx but when I try to import it in Colab like this import osmnx give me this error
AttributeError: /usr/bin/python3: undefined symbol: Error_GetLastErrorNum
Does anyone know how to fix this error?

You need to install libspatialindex-dev first.
!apt install libspatialindex-dev
!pip install osmnx
Then you can import it
import osmnx

Related

Installed transforemers but cannot be imported on Google CoLab / StableDiffusion

I am trying to run the stablediffusion example from this link: https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/stable_diffusion.ipynb#scrollTo=zTDA0fvtuOIQ
!pip install diffusers==0.3.0
!pip install transformers scipy ftfy
!pip install "ipywidgets>=7,<8"
!pip install transformers
from google.colab import output
output.enable_custom_widget_manager()
from huggingface_hub import notebook_login
notebook_login()
I installed the required dependencies and restarted the runtime and then ran the following code:
import torch from diffusers import StableDiffusionPipeline pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", revision="fp16", torch_dtype=torch.float16, use_auth_token=True)
But It spits out the following errors:
ImportError: cannot import name 'CLIPFeatureExtractor' from 'transformers' (/usr/local/lib/python3.7/dist-packages/transformers/init.py)
How should I fix the problem?

Networkx & Jupyter Notebook using pip AttributeError

Hi everyone, I'm trying to create a network visualization with python using the networkx package. Unfortunately I'm getting a "AttributeError: module 'scipy.sparse' has no attribute 'coo_array'" at the end of my code. I've tried to fix it but every help in the internet points towards upgrading pip or conda which I've done and still get the same error. I'm using jupyter notebooks - any help would be greatly appreciated!
#Prerequisites
import sys
!{sys.executable} -m pip install --user networkx
!{sys.executable} -m pip install --user numpy
!{sys.executable} -m pip install --user pandas
pip install notebook --upgrade
conda upgrade notebook
import networkx as nx
import numpy as np
import pandas as pd
from pathlib import Path
from pandas import DataFrame
#Read in Source File - NB this must match the schema requirements
df_InputData = pd.read_excel("/Users/paulkruse/Desktop/FR/Fr1.xlsx")
Src_Column = 'Source ID'
Tgt_Column = 'Target ID'
print(df_InputData);
#Nodes are positioned using the Fruchterman-Reingold force-directed algorithm.
Q = nx.Graph()
arr_SrcTgt= np.array(df_InputData[[Src_Column, Tgt_Column]])
print(arr_SrcTgt);
Q.add_edges_from(arr_SrcTgt)
dict_Coords = nx.spring_layout(Q)
It seems that your scipy version is out of date. The most recent version 1.8.1 certainly has coo_array function. One way to resolve this should be to upgrade scipy. If you're doing this from inside jupyter notebook, then use
!pip install --user scipy==1.8.1
Make sure to restart kernel after installation.

Cannot use giotto in google colab

I installed giotto-tda library with a command: %pip install --user pyproj giotto-tda
and then tried to use: from gtda.time_series import TakensEmbedding
but I am still getting an error: "No module named 'gtda'.
Did you have a similar problem?

AttributeError: module 'community' has no attribute 'best_partition'

I try to run this code:
from cdlib import algorithms
import networkx as nx
G = nx.karate_club_graph()
coms = algorithms.louvain(G, resolution=1., randomize=False)
but the error remains the same.
I have tried all options given by
AttributeError: module 'networkx.algorithms.community' has no attribute 'best_partition'
but it doesn't work.
Also, I'm working in Google Colab and I have installed cdlib.
If still useful, this worked out for me :
pip uninstall community
pip install python-louvain
I could import community afterwards and use best_partition.
From this, it looks like there is a community python package that conflicts with the python-louvain package. Both packages happen to be pre-installed in google colab kernels. To avoid this conflict, I just uninstalled networkx, python-louvain and community and then reinstalled networkx and python-louvain. Finally I installed cdlib.
After that I ran your code and everything worked well. So overall the code is:
!pip uninstall networkx
!pip uninstall python-louvain
!pip uninstall community
!pip install python-louvain
!pip install networkx
!pip install cdlib
from cdlib import algorithms
import networkx as nx
G = nx.karate_club_graph()
coms = algorithms.louvain(G, resolution=1., randomize=False)
print(coms)
And the ouput gives:

'import intake' in google colab generates ContextualVersionConflict

!pip install intake-esm
install the latest version of intake-esm (2020.12.18) in google colab
but the import intake statement generates the following error:
ContextualVersionConflict: (requests 2.23.0 (/usr/local/lib/python3.6/dist-packages), Requirement.parse('requests>=2.24.0'), {'intake-esm'})
could anybody please tell me what is going wrong or how to fix this?
At first install intake-esm
!pip install intake-esm
Then install astropy >= 3.1 and sunpy
!pip install astropy>=3.1
!pip install sunpy
Finally, import intake
import intake
Following this, I can import intake.

Categories

Resources