Import Pyodbc error while running a python script on pycharm on mac - pyodbc

I'm getting pyodbc import error while i'm trying to run a python script on pycharm
I have already tried pip install pyodbc , and also brew install unixodbc
I'm still getting the below error.
Traceback (most recent call last):
File "/Users/s0s0qw4/astro-airflow-localdev/dags/dremio.ak.py", line 17, in <module>
import pyodbc
ImportError: dlopen(/Users/s0s0qw4/astro-airflow-localdev/venv/lib/python3.10/site-packages/pyodbc.cpython-310-darwin.so, 0x0002): Library not loaded: '/usr/local/opt/unixodbc/lib/libodbc.2.dylib'
Referenced from: '/Users/s0s0qw4/astro-airflow-localdev/venv/lib/python3.10/site-packages/pyodbc.cpython-310-darwin.so'
Reason: tried: '/usr/local/opt/unixodbc/lib/libodbc.2.dylib' (no such file), '/usr/lib/libodbc.2.dylib' (no such file)
I have tried to uninstall pyodbc and reinstall. I'm getting the below error:
import pyodbc
ImportError: dlopen(/Users/s0s0qw4/astro-airflow-localdev/venv/lib/python3.10/site-packages/pyodbc.cpython-310-darwin.so, 0x0002): Library not loaded: '#rpath/libodbc.2.dylib'
Referenced from: '/Users/s0s0qw4/astro-airflow-localdev/venv/lib/python3.10/site-packages/pyodbc.cpython-310-darwin.so'
Reason: tried: '/usr/lib/libodbc.2.dylib' (no such file)

Related

Problem to open Jupyter notebook: cannot import name 'escape' from 'markupsafe'

Have you guys faced this problem before? I was installing cuCNN and after the installation, I cannot open Jupyter Notebooks anymore.
When I try it I got this error:
(base) PS C:\Users\USER> jupyter notebook
(base) PS C:\Users\USER> jupyter notebook
Traceback (most recent call last):
File "D:\Program Files(D)\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "D:\Program Files(D)\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 43, in <module>
from jinja2 import Environment, FileSystemLoader
File "D:\Program Files(D)\Anaconda3\lib\site-packages\jinja2\__init__.py", line 6, in <module>
from markupsafe import escape
ImportError: cannot import name 'escape' from 'markupsafe' (unknown location)
(base) PS C:\Users\USER>
Does anyone know how to solve it?
I executed these commands to install cuDNN:
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/
python3 -m pip install tensorflow
https://www.tensorflow.org/install/pip#windows-wsl2
I solved it hopefully:
"You have to reinstall markupsafe"
After trying several things I had to remove "markupsafe" manually, because "pip uninstall markupsafe" did not work out, once removed it, proceed to install markupsafe again(pip install markupsafe)... and that's it.
Note that for me only worked markupsafe 2.0.1, superior versions had other problems(this problem: https://github.com/aws/aws-sam-cli/issues/3661)
pip install markupsafe==2.0.1

pip install ngrok ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output

im trying to pip install ngrok but i got the error.
i use ubuntu server
I haven't been able to solve it for hours :(
please help me
pip install ngrok
/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py:122: PkgResourcesDeprecationWarning: 0.1.36ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py:122: PkgResourcesDeprecationWarning: 0.23ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
Collecting ngrok
Using cached ngrok-0.1.6.tar.gz (3.5 kB)
Collecting ping
Using cached ping-0.2.tar.gz (10 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qanhr0lu/ping/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qanhr0lu/ping/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-qanhr0lu/ping/pip-egg-info
cwd: /tmp/pip-install-qanhr0lu/ping/
Complete output (8 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-qanhr0lu/ping/setup.py", line 23, in <module>
from ping import __version__
File "/tmp/pip-install-qanhr0lu/ping/ping.py", line 196
except socket.error, (errno, msg):
^
SyntaxError: invalid syntax
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I'm not sure which python ngrok library you are trying to install, but I suspect it's probably pyngrok which is installed using: pip install pyngrok
source: https://pyngrok.readthedocs.io/en/latest/index.html

Pytorch import error in Jupyter notebook in Windows

I installed torch 1.5.1 using conda install with CUDA 10.2. I was able to install it successfully. While importing torch in Jupyter, I am getting below error.
OSError: [WinError 127] The specified procedure could not be found. Error loading "c:\users\shashank\anaconda3\lib\site-packages\torch\lib\caffe2.dll" or one of its dependencies.

No module name telethon

from telethon import TelegramClient
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'telethon'
Installed it using : sudo pip3 install telethon
Switched to python3 on console and ran the above import command.
I have both python 2 and 3.

Upgrading from IPython 5.x to 6.0 results in crash due to IPython.utils.warn

I recently upgraded from IPython 5.x to 6.0 via condo update ipython. However, I get a crash in the kernel:
Traceback (most recent call last):
File "//anaconda/lib/python3.5/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "//anaconda/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "//anaconda/lib/python3.5/site-packages/ipykernel/__main__.py", line 2, in <module>
from ipykernel import kernelapp as app
File "//anaconda/lib/python3.5/site-packages/ipykernel/kernelapp.py", line 37, in <module>
from .ipkernel import IPythonKernel
File "//anaconda/lib/python3.5/site-packages/ipykernel/ipkernel.py", line 15, in <module>
from .zmqshell import ZMQInteractiveShell
File "//anaconda/lib/python3.5/site-packages/ipykernel/zmqshell.py", line 46, in <module>
from IPython.utils.warn import error
ImportError: No module named 'IPython.utils.warn'
[I 18:35:28.928 NotebookApp] KernelRestarter: restarting kernel (1/5)
Apparently, the issue is that IPython.utils.warn was deprecated and has now been removed as of version 6.0.0. How can I fix this?
Note: none of the following worked:
pip install --upgrade ipython
pip install --upgrade jupyter
pip install --upgrade --no-deps --force-reinstall ipython
pip install --upgrade --no-deps --force-reinstall jupyter
I had the same issue. The following line fixed the issue for me:
conda update ipykernel
I don't know why this is not done automatically.
+1 same problem.
Workaround was to downgrade to the latest available 5.x version of iPython (currently 5.3.0 found via conda search ipython):
conda install ipython=5.3.0
Now Jupyter notebook kernel can start again.

Resources