New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No module named 'psycopg2' when running 04 - Ingest notebooks #199
Comments
I did run bash-4.2$ pip install psycopg2-binary and this works bash-4.2$ python
I did restart kernel many times. |
This was using SQLAlchemy 1.3.13, if I rerun setup and get 1.3.22 I briefly got the error TypeError: public_factory() takes 2 positional arguments but 3 were given, but then it goes back to psycopg2 import error when restarting kernel. Any ideas on what extra setup we might need to run here? |
@alanzablocki did you run the 01_setup/ set of notebooks to get everything installed?
|
Hi Chris I did, and I did not hit this issue in your workshop, just on a fresh sagemaker instance. I did run the command you gave above and still the same issue, what is interesting, is that I can do import psycopg2 in the cmd ( base env and default python), but I cannot import psycopg2 in the jupyter notebook on its own, and so when I run create_engine() that is what trips the notebook up as well. (base) bash-4.2$ python
(base) bash-4.2$ conda deactivate
|
interesting, yeah i remember having a similar issue at one point with the psycopg2 import, but can't remember the details. by "sagemaker instance", do you mean SM Studio? we've only been testing in SM Studio recently. either way, which Kernel are you using? can you list all the installed python libraries? |
Yes I am using Sagemaker Studio just like in the workshop. Using Python3 (data science) kernel Here is the pip freeze output: aioboto3==6.5.0 |
and here is the conda list output bash-4.2$ conda list packages in environment at /opt/conda:Name Version Build Channel_libgcc_mutex 0.1 conda_forge conda-forge |
|
Trying to run Ingest module from workshop, folder #4, notebooks 7,8 and 9, and this statement results in an error:
engine = create_engine('postgresql://{}:{}@{}:{}/{}'.format(master_user_name, master_user_pw, redshift_endpoint_address, redshift_port, database_name_redshift))
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 engine = create_engine('postgresql://{}:{}@{}:{}/{}'.format(master_user_name, master_user_pw, redshift_endpoint_address, redshift_port, database_name_redshift))
/opt/conda/lib/python3.7/site-packages/sqlalchemy/engine/init.py in create_engine(*args, **kwargs)
518 strategy = kwargs.pop("strategy", default_strategy)
519 strategy = strategies.strategies[strategy]
--> 520 return strategy.create(*args, **kwargs)
521
522
/opt/conda/lib/python3.7/site-packages/sqlalchemy/engine/strategies.py in create(self, name_or_url, **kwargs)
85 if k in kwargs:
86 dbapi_args[k] = pop_kwarg(k)
---> 87 dbapi = dialect_cls.dbapi(**dbapi_args)
88
89 dialect_args["dbapi"] = dbapi
/opt/conda/lib/python3.7/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py in dbapi(cls)
776 @classmethod
777 def dbapi(cls):
--> 778 import psycopg2
779
780 return psycopg2
ModuleNotFoundError: No module named 'psycopg2'
Is there a recommended install?
I tried pip install and it did not work.
pip freeze returns
psycopg2==2.7.7
bash-4.2$ python -V
Python 3.7.10
bash-4.2$ pip -V
pip 21.0.1 from /opt/conda/lib/python3.7/site-packages/pip (python 3.7)
bash-4.2$
The text was updated successfully, but these errors were encountered: