When i try to run the following code to open an image - opencv-python

import matplotlib.
matplotlib.use('TkAgg').
import matplotlib.pyplot as plt.
from PIL import Image.
pic =Image.open('User/XYZ/Downloads/DATA/XYZ.jpg')
I get this error.
fp = builtins.open(filename, "rb").
IOError: [Errno 2] No such file or directory: 'User/XYZ/Downloads/DATA/XYZ.jpg'

Related

ImportError: cannot import name 'core' from 'numpy' (unknown location)

ImportError Traceback (most recent call last)
c:\Users\ychen\Documents\GitHub\pollen_testing.ipynb Cell 1' in <cell line: 3>()
1 import pandas as pd
2 import numpy as np
----> 3 from psy_strat.stratplot import stratplot
5 from IPython.display import Image
6 from overnight_consistency_checker import ConsistencyChecker, FFT_values
What is wrong with it, I do not know how to fix this problem. I even try to install numpy again, it does still not work out.

Import Error : cannot import name 'linlag' from 'scipy'

Uninstalled & reinstalled scipy package, though cannot seem to import linalg function.
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-133368b721e2> in <module>
1 import numpy as np
2 import sklearn
----> 3 from scipy import linlag
ImportError: cannot import name 'linlag' from 'scipy' (C:\Users\lenov\anaconda3\lib\site-packages\scipy\__init__.py)
It's a minor syntax error. It should be "linalg".

Getting an error when using PIL img.show()

I have an image in my directory, say "image.png". This is the code I run:
from PIL import Image
img = Image.open("image.png")
img.show()
And the error message that pops up is: "FSPathMakeRef(/Applications/Preview.app) failed with error -43."
Anyone know what this means?

Pandas Import : ModuleNotFoundError: No module named 'pandas.api.extensions'

I wanted to import geopandas as gpd, but the error message appears
ModuleNotFoundError: No module named 'pandas.api.extensions'.
What I have to do, to import geopandas?
I installed geopandas via anaconda promt:
C:\Users\sar>conda install -c conda-forge geopandas
Collecting package metadata (current_repodata.json): done
Solving environment: done
All requested packages already installed.
When i import geopandas, following code is shown in the console:
import geopandas as gpd
Traceback (most recent call last):
File "<ipython-input-16-a62d01c1d62e>", line 1, in <module>
import geopandas as gpd
File "C:\Users\sar\Anaconda\envs\codingingis\lib\site-packages\geopandas\__init__.py", line 1, in <module>
from geopandas.geoseries import GeoSeries # noqa
File "C:\Users\sar\Anaconda\envs\codingingis\lib\site-packages\geopandas\geoseries.py", line 15, in <module>
from geopandas.base import GeoPandasBase, _delegate_property
File "C:\Users\sar\Anaconda\envs\codingingis\lib\site-packages\geopandas\base.py", line 13, in <module>
from .array import GeometryArray, GeometryDtype
File "C:\Users\sar\Anaconda\envs\codingingis\lib\site-packages\geopandas\array.py", line 7, in <module>
from pandas.api.extensions import ExtensionArray, ExtensionDtype
ModuleNotFoundError: No module named 'pandas.api.extensions'
in array.py this code is not found:
from pandas.api.extensions import ExtensionArray, ExtensionDtype

jython: how to crop a png image file

I tried PIL (Python Image Library). Unfortunately, jython doesn't support it.
import Image
im = Image.open("tmp.png")
box = (100,200,300,400)
region = im.crop(box)
And the error message is
File "dota\PIL\Image.py", line 37, in __getattr__
raise ImportError("The _imaging C module is not installed")
ImportError: The _imaging C module is not installed
Is there other way?