I was trying to run some python code in docker and export a .csv file to S3, but got the same error as in aiobotocore - ImportError: cannot import name 'InvalidIMDSEndpointError' (asking here because I don't have enough reputation to comment under that thread..)
File "/opt/conda/lib/python3.7/site-packages/s3fs/__init__.py", line 1, in <module>
from .core import S3FileSystem, S3File
File "/opt/conda/lib/python3.7/site-packages/s3fs/core.py", line 14, in <module>
import aiobotocore
File "/opt/conda/lib/python3.7/site-packages/aiobotocore/__init__.py", line 1, in <module>
from .session import get_session, AioSession
File "/opt/conda/lib/python3.7/site-packages/aiobotocore/session.py", line 6, in <module>
from .client import AioClientCreator, AioBaseClient
File "/opt/conda/lib/python3.7/site-packages/aiobotocore/client.py", line 12, in <module>
from .utils import AioS3RegionRedirector
File "/opt/conda/lib/python3.7/site-packages/aiobotocore/utils.py", line 10, in <module>
from botocore.exceptions import (
ImportError: cannot import name 'InvalidIMDSEndpointError' from 'botocore.exceptions' (/opt/conda/lib/python3.7/site-packages/botocore/exceptions.py)
I tried to use the versions of libraries as in the comment:
botocore==1.19.52
s3fs==0.5.1
boto3==1.16.52
aiobotocore==1.2.0
However, these don't solve the problem and I still get the same error.
Could anyone here give me some hints how to solve this?
Thanks!
Ok, I can answer my own question :)
Just install s3fs, and it will take care of version dependencies of other libraries..
Related
I would like to use the cryptography's module on Windows, I am using version 1.12 and Python 3.10.6, and I have some problems. Actually, when I run my script, I receive the error :
`
Traceback (most recent call last):
File "C:/Users/edoua/Documents/cryptographie.py", line 1, in <module>
from cryptography.fernet import Fernet
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\fernet.py", line 16, in <module>
from cryptography.hazmat.primitives.hmac import HMAC
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\hazmat\primitives\hmac.py", line 10, in <module>
from cryptography.hazmat.backends.openssl.hmac import _HMACContext
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\hazmat\backends\openssl\__init__.py", line 6, in <module>
from cryptography.hazmat.backends.openssl.backend import backend
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 13, in <module>
from cryptography import utils, x509
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\x509\__init__.py", line 7, in <module>
from cryptography.x509.base import (
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\x509\base.py", line 28, in <module>
from cryptography.x509.extensions import (
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\x509\extensions.py", line 25, in <module>
from cryptography.x509.general_name import (
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\x509\general_name.py", line 9, in <module>
from email.utils import parseaddr
File "C:\Users/edoua/Documents\email.py", line 18, in <module>
server.login(email_address, email_password)
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 739, in login
(code, resp) = self.auth(
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 641, in auth
response = encode_base64(initial_response.encode('ascii'), eol='')
NameError: name 'encode_base64' is not defined
`
It is coming from the smtplib.py file. Also, I precise that the module works perfectly, I can use all the functions of the module base64. So the problem is coming from the word 'encode_base64'. Please help !
I tried to launch my program, and that error occures, I expected that it was going to work.
You have a local module C:\Users/edoua/Documents\email.py that is shadowing the email module from the Python standard library. Rename email.py to something else, or move it to somewhere that isn't on the Python path.
I'm trying to build a discord bot, and I have this error that I can't seem to figure out that explicitly happens when I try to import discord.py
The error message is:
Traceback (most recent call last):
File "C:/Users/Pastry/PycharmProjects/PastryBot/sample.py", line 1, in <module>
import discord
File "C:\Python35\lib\site-packages\discord\__init__.py", line 20, in <module>
from .client import Client, AppInfo, ChannelPermissions
File "C:\Python35\lib\site-packages\discord\client.py", line 28, in <module>
from .user import User
File "C:\Python35\lib\site-packages\discord\user.py", line 27, in <module>
from .utils import snowflake_time
File "C:\Python35\lib\site-packages\discord\utils.py", line 31, in <module>
import asyncio
File "C:\Python35\lib\asyncio\__init__.py", line 21, in <module>
from .base_events import *
File "C:\Python35\lib\asyncio\base_events.py", line 18, in <module>
import concurrent.futures
File "C:\Python35\lib\concurrent\futures\__init__.py", line 17, in <module>
from concurrent.futures.process import ProcessPoolExecutor
File "C:\Python35\lib\concurrent\futures\process.py", line 55, in <module>
from multiprocessing.connection import wait
File "C:\Python35\lib\multiprocessing\connection.py", line 18, in <module>
import tempfile
File "C:\Python35\lib\tempfile.py", line 45, in <module>
from random import Random as _Random
ImportError: cannot import name 'Random'
I tried using the sample code from the quickstart bot guide on their documentation page as well, and ran into the same error. I thought it was a problem with my version of discord.py so I tried to update it, and then re-ran the program but I'm still getting this error. Could anyone help enlighten me?
Did you download the discord.py library? that could be the the problem. What about the asyncio library? Those two are most likely.
I'm trying to use iohub to incorporate Eye-Tracking (SR-research Eye-Link) support in my experiment in Psychopy.
I'm using python2.7 on a Mac.
However, I get an error while I'm trying to import it:
from psychopy.iohub.datastore.util import ExperimentDataAccessUtility
File "/Users/.../ETUtilities.py", line 2, in <module>
from psychopy.iohub.datastore.util import ExperimentDataAccessUtility
File "/Library/Python/2.7/site-packages/PsychoPy-1.82.01-py2.7.egg/psychopy/iohub/datastore/__init__.py", line 16, in <module>
import tables
File "/Library/Python/2.7/site-packages/tables/__init__.py", line 90, in <module>
from .utilsextension import (
ImportError: cannot import name get_pytables_version
I tried to install this module but found nothing.
Any idea?
You mean you didn't find the module?
https://www.google.com/search?source=hp&ei=bGw7WtaDCMbDgAb6qo3gAw&q=pytables&oq=pytables&gs_l=psy-ab.3..35i39k1l2j0l8.592.592.0.784.2.1.0.0.0.0.125.125.0j1.1.0.crnk_dmh...0...1.2.64.psy-ab..1.1.124.0...0.LZUJpfdZBYE
My code is simply the follow and work few days ago:
import pandas as pd
df = pd.read_csv('WORLDBANK-ZAF_MYS_PROP_4044_SEC_MF.csv')
print(df.head())
But now whenever I try to run it by calling python my_io.py on my Mac terminal it generates the following messages:
Bases-MacBook-Pro:data_analysis me$ python my_io.py
Traceback (most recent call last):
File "my_io.py", line 1, in
import pandas as pd
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/init.py", line 13, in
import(dependency)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/init.py", line 142, in
from . import add_newdocs
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/init.py", line 8, in
from .type_check import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in
import numpy.core.numeric as _nx
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/init.py", line 72, in
from numpy.testing.nosetester import _numpy_tester
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/testing/init.py", line 12, in
from . import decorators as dec
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/testing/decorators.py", line 20, in
from .utils import SkipTest, assert_warns
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/testing/utils.py", line 15, in
from tempfile import mkdtemp, mkstemp
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 32, in
import io as _io
File "/Users/gongzhuli/Desktop/data_analysis/io.py", line 3, in
AttributeError: 'module' object has no attribute 'read_csv'
Can someone please help me, I have no idea what is going on here..
Your file is called io.py, which is a library module to handle file-like buffers among other things.
pandas imports tempfile which needs it:
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 32, in <module>
import io as _io
and your filename gets in the way of the import chain and prevents import from going through.
Just rename your file with something more specific (like my_io.py for instance?)
I am getting following error while importing SQLObject on Window. Does anyone knows what is this error about and how to solve it?
==============================
from sqlobject import *
File "c:\python26\lib\site-packages\sqlobject-0.10.4-py2.6.egg\sqlobject\__init__.py", line 5, in <module>
from main import *
File "c:\python26\lib\site-packages\sqlobject-0.10.4-py2.6.egg\sqlobject\main.py", line 32, in <module>
import dbconnection
File "c:\python26\lib\site-packages\sqlobject-0.10.4-py2.6.egg\sqlobject\dbconnection.py", line 17, in <module>
from joins import sorter
File "c:\python26\lib\site-packages\sqlobject-0.10.4-py2.6.egg\sqlobject\joins.py", line 5, in <module>
import events
File "c:\python26\lib\site-packages\sqlobject-0.10.4-py2.6.egg\sqlobject\events.py", line 3, in <module>
from sqlobject.include.pydispatch import dispatcher
File "c:\python26\lib\site-packages\sqlobject-0.10.4-py2.6.egg\sqlobject\include\pydispatch\dispatcher.py", line 30, in <module>
import saferef, robustapply, errors
EOFError: EOF read where object expected
Looks like your c:\python26\lib\site-packages\sqlobject-0.10.4-py2.6.egg file may be truncated or otherwise damaged. How does it compare to a freshly downloaded one (in terms of both length and checksum)?