error trying to import some spatial analysis libraries in jupyter notebook: ImportError: DLL load failed: El sistema operativo no puede ejecutar %1 - jupyter

I'm trying to run this code on jupyter notebook to work with geopandas for making geospatial analysis:
%matplotlib inline
import numpy as np, matplotlib.pyplot as plt, pandas as pd, geopandas as gpd
from mpl_toolkits.basemap import Basemap
from shapely.geometry import Point
from geopy.distance import great_circle
this is the error message I got after run the code:
ImportError Traceback (most recent call last)
<ipython-input-2-987457051b80> in <module>
1 # import necessary modules
----> 2 import numpy as np, matplotlib.pyplot as plt, pandas as pd, geopandas as gpd
3 from mpl_toolkits.basemap import Basemap
4 from shapely.geometry import Point
5 from geopy.distance import great_circle
C:\Anaconda\lib\site-packages\geopandas\__init__.py in <module>
2 from geopandas.geodataframe import GeoDataFrame
3
----> 4 from geopandas.io.file import read_file
5 from geopandas.io.sql import read_postgis
6 from geopandas.tools import sjoin
C:\Anaconda\lib\site-packages\geopandas\io\file.py in <module>
1 import os
2
----> 3 import fiona
4 import numpy as np
5 import six
C:\Anaconda\lib\site-packages\fiona\__init__.py in <module>
81 os.environ["PATH"] = os.environ["PATH"] + ";" + libdir
82
---> 83 from fiona.collection import BytesCollection, Collection
84 from fiona.drvsupport import supported_drivers
85 from fiona.env import ensure_env_with_credentials, Env
C:\Anaconda\lib\site-packages\fiona\collection.py in <module>
7
8 from fiona import compat, vfs
----> 9 from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
10 from fiona.ogrext import Session, WritingSession
11 from fiona.ogrext import buffer_to_virtual_file, remove_virtual_file, GEOMETRY_TYPES
ImportError: DLL load failed: El sistema operativo no puede ejecutar %1.
Can you provide any help?

Related

NotFittedError: Vocabulary not fitted or provided or TypeError: string indices must be integers

Hello everyone, im new hier and want to start learning how machine learning works. So i want to build a machine learning email spam detector in colab, but something seems to be wrong:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import nltk import string
from nltk.corpus import stopwords
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB, GaussianNB
from sklearn import svm
from sklearn.model_selection import GridSearchCV
from google.colab import files
uploaded = files.upload() filename = ('spam.tsv')
content = []
with open(filename, "r") as file_content:
for line in file_content.readlines():
line = line.strip() content.append(line)
spam = line
#print(spam) for testinn if it is working
z = spam['EmailText']
y = spam["Label"]
z_train, z_test,y_train, y_test = train_test_split(z,y,test_size = 0.2)
count_vector = CountVectorizer()
features = count_vector.transform(z_train)
model = svm.SVC()
model.fit(features,y_train)
features_test = count_vector.transform(z_test)
print(model.score(features_test,y_test))`
NotFittedError: Vocabulary not fitted or provided TypeError: string indices must be integers
i tried everything but nothing works really haha
i hope, you can help
thank you

findDecoder imread_('cat.jpg'): can't open/read file: check file path/integrity

I have not solved the following problem (Python 3.9.13, Win10).
import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('cat.jpg,', 3)
print(img)
cv.imshow('cat', img)
plt.imshow(img)
plt.show()
print(img) was None
The size of cat.jpg is 372Kb.
There is cat.jpg which located at the same level of python code1.py.
Also, I installed opencv-python-headless.
Then, I ran it. Following waning appeared;
[ WARN:0#0.758].......oadsave.cpp (239) cv::findDecoder imread_('cat.jpg'):
can't open/read file: check file path/integrity

ImportError with "scenarios.py"

Thank you for your help in advance!
I had the following error, for example, when running the first cell in pose.ipynb. I have tried reinstalling drake and manipulation on my local machine with the newest version, but I still have the same problem. Can you please help me out with it?
ImportError Traceback (most recent call last)
Cell In [1], line 23
9 from pydrake.all import (AbstractValue, AddMultibodyPlantSceneGraph, AngleAxis,
10 BaseField, ConstantValueSource, CsdpSolver,
11 DepthImageToPointCloud, DiagramBuilder,
(...)
19 RollPitchYaw, RotationMatrix, Simulator, StartMeshcat,
20 ge)
22 from manipulation import running_as_notebook
---> 23 from manipulation.scenarios import (AddIiwaDifferentialIK, AddMultibodyTriad,
24 AddRgbdSensor, MakeManipulationStation)
25 from manipulation.meshcat_utils import AddMeshcatTriad, draw_open3d_point_cloud
26 from manipulation.utils import AddPackagePaths, FindResource
File ~/manipulation-master/manipulation/scenarios.py:10
7 import warnings
9 import numpy as np
---> 10 from pydrake.all import (
11 AbstractValue, Adder, AddMultibodyPlantSceneGraph, BallRpyJoint, BaseField,
12 Box, CameraInfo, ClippingRange, CoulombFriction, Cylinder, Demultiplexer,
13 DepthImageToPointCloud, DepthRange, DepthRenderCamera, DiagramBuilder,
14 FindResourceOrThrow, GeometryInstance, InverseDynamicsController,
15 LeafSystem, LoadModelDirectives, LoadModelDirectivesFromString,
16 MakeMultibodyStateToWsgStateSystem, MakePhongIllustrationProperties,
...
23 DifferentialInverseKinematicsIntegrator,
24 DifferentialInverseKinematicsParameters)
26 from manipulation.utils import AddPackagePaths, FindResource
ImportError: cannot import name 'LoadModelDirectivesFromString' from 'pydrake.all' (/home/obito/env_drake/lib/python3.8/site-packages/pydrake/all.py)
LoadModelDirectivesFromString was added to Drake only in the last few days. You just need to update your installation of Drake.

iPython bokeh import error Row and SizingMode

I followed this notebook to try bokeh with iPyhton Notebook: https://github.com/bokeh/bokeh/blob/0.12.3/examples/howto/notebook_comms/Basic%20Usage.ipynb
I dont know how to interpret and fix those errors:
error 1:
from bokeh.io import push_notebook, show, output_notebook
from bokeh.layouts import row
from bokeh.plotting import figure
output_notebook()
ImportError Traceback (most recent call
last) in ()
3
4 from bokeh.io import push_notebook, show, output_notebook
----> 5 from bokeh.layouts import row
6 from bokeh.plotting import figure
7 output_notebook()
/opt/conda/lib/python2.7/site-packages/bokeh/layouts.py in ()
8 from future import absolute_import
9
---> 10 from .core.enums import Location, SizingMode
11 from .models.tools import ToolbarBox
12 from .models.plots import Plot
ImportError: cannot import name SizingMode
error 2:
from ipywidgets import interact
import numpy as np
from bokeh.io import push_notebook, show, output_notebook
from bokeh.plotting import figure
output_notebook()
ImportError Traceback (most recent call
last) in ()
6
7 from bokeh.io import push_notebook, show, output_notebook
----> 8 from bokeh.plotting import figure
9 output_notebook()
/opt/conda/lib/python2.7/site-packages/bokeh/plotting/init.py in
()
3
4 from ..models import ColumnDataSource; ColumnDataSource
----> 5 from ..models.layouts import Row, Column; Row, Column
6
7 from ..io import curdoc; curdoc
ImportError: cannot import name Row
bokeh : 0.12.3
tornado: 4.4.2
python: 2.7
the problem was that the iPython notebook kernel was out of sync. restarting the notebook server was the solution

IPython fails to import pandas from Miniconda

I'm using IPython and pandas to work with Google Bigquery. I installed pandas using 'condas install pandas'. And I believe Miniconda stalled all dependencies. But when I tried to import pandas in IPython notebook, it gave me the following errors:
>
> ---------------------------------------------------------------------------
> ImportError Traceback (most recent call last)
> <ipython-input-1-a3826df0a77b> in <module>()
> ----> 1 import pandas as pd
> 2
> 3 projectid = "geotab-bigdata-test"
> 4 data_frame = pd.read_gbq('SELECT * FROM RawVin.T20141201', project_id = projectid)
>
> C:\Users\fionazhao\Installed\Continuum\Miniconda\lib\site-packages\pandas\__init__.pyc
> in <module>()
> 45
> 46 # let init-time option registration happen
> ---> 47 import pandas.core.config_init
> 48
> 49 from pandas.core.api import *
>
> C:\Users\fionazhao\Installed\Continuum\Miniconda\lib\site-packages\pandas\core\config_init.py
> in <module>()
> 15 is_instance_factory, is_one_of_factory,
> 16 get_default_val)
> ---> 17 from pandas.core.format import detect_console_encoding
> 18
> 19
>
> C:\Users\fionazhao\Installed\Continuum\Miniconda\lib\site-packages\pandas\core\format.py
> in <module>()
> 7 from pandas.core.base import PandasObject
> 8 from pandas.core.common import adjoin, notnull
> ----> 9 from pandas.core.index import Index, MultiIndex, _ensure_index
> 10 from pandas import compat
> 11 from pandas.compat import(StringIO, lzip, range, map, zip, reduce, u,
>
> C:\Users\fionazhao\Installed\Continuum\Miniconda\lib\site-packages\pandas\core\index.py
> in <module>()
> 13 import pandas.algos as _algos
> 14 import pandas.index as _index
> ---> 15 from pandas.lib import Timestamp, Timedelta, is_datetime_array
> 16 from pandas.core.base import PandasObject, FrozenList, FrozenNDArray, IndexOpsMixin, _shared_docs
> 17 from pandas.util.decorators import (Appender, Substitution, cache_readonly,
>
> ImportError: cannot import name Timedelta
Found solutions myself. When install pandas using Miniconda, we should make sure all python threads have been stopped. Otherwise, it'll messed up the installation and bring such errors.
I just stopped all python threads, re-install pandas by 'conda install -f pandas', and the errors gone