Cannot run anaconda - python

I just installed anaconda and I have udpated the PATH variable.
However, I cannot run any conda related commands.
Every time I run a command starting with "conda" I get the following error.
Can anyone help?
I am using macOs High Sierra 10.13.6.
Traceback (most recent call last):
File "/anaconda3/lib/python3.6/site-packages/conda/common/path.py", line 18, in <module>
from urllib.request import url2pathname
File "/anaconda3/lib/python3.6/urllib/request.py", line 2585, in <module>
from _scproxy import _get_proxy_settings, _get_proxies
ImportError: dlopen(/anaconda3/lib/python3.6/lib-dynload/_scproxy.cpython-36m-darwin.so, 2): Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /anaconda3/lib/libJPEG.dylib
in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/anaconda3/bin/conda", line 11, in <module>
sys.exit(main())
File "/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 112, in main
from ..exceptions import conda_exception_handler
File "/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 18, in <module>
from .common.io import timeout
File "/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 24, in <module>
from .path import expand
File "/anaconda3/lib/python3.6/site-packages/conda/common/path.py", line 21, in <module>
from urllib import unquote, url2pathname # NOQA
ImportError: cannot import name 'unquote'

I seem to recall something similar when I first ran Anaconda on my Mac as well. I believe I solved it by doing two things:
Uninstalling Anaconda (Link)
Reinstalling Anaconda (potentially in a different location, say, under your User home)
I think in the process of installation my PATH pointed finally to a different location than the Conda/Python install.

Related

cannot launch Jupyter from anaconda

I just got a new laptop at work and installed anaconda.. howerver, when i launched Jupyter I received the following error. Does anyone know what i should do here? Cheers
Traceback (most recent call last):
File "C:\Users\darren.chapman\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 9, in
import sqlite3
File "C:\Users\darren.chapman\AppData\Local\Continuum\anaconda3\lib\sqlite3\__init__.py", line 23, in
from sqlite3.dbapi2 import *
File "C:\Users\darren.chapman\AppData\Local\Continuum\anaconda3\lib\sqlite3\dbapi2.py", line 27, in
from _sqlite3 import *
ImportError: DLL load failed: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\darren.chapman\AppData\Local\Continuum\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in
from notebook.notebookapp import main
File "C:\Users\darren.chapman\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\notebookapp.py", line 86, in
from .services.sessions.sessionmanager import SessionManager
File "C:\Users\darren.chapman\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 12, in
from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'
You have to add the path.
while installing click the add anoconda to the path.

Issue running python script via PyCharm but not Anaconda Prompt

When I run a script in Anaconda Prompt, it works fine.
When I try to run it via PyCharm, I get this error related to the import of pandas.
C:\ProgramData\Anaconda3\python.exe C:/Users/MYUSERNAME/PycharmProjects/CARA/DocumentAccessCheck.py
Traceback (most recent call last):
File "C:/Users/MYUSERNAME/PycharmProjects/CARA/DocumentAccessCheck.py", line 2, in <module>
import pandas as pd
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
Process finished with exit code 1
If I try to import numpy and run it via PyCharm I get:
C:\ProgramData\Anaconda3\python.exe C:/Users/MYUSERNAME/PycharmProjects/CARA/DocumentAccessCheck.py
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 16, in <module>
from . import multiarray
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/MYUSERNAME/PycharmProjects/CARA/DocumentAccessCheck.py", line 2, in <module>
import numpy as np
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: The specified module could not be found.
Process finished with exit code 1
Running the same script in Anaconda prompt...no problem
My run configuration in PyCharm uses the Anaconda python distribution?
It should be noted that I am not using envirnoments, just the base Anaconda installation. More worryingly I dont see ANY Conda options in the project settings in PyCharm which a lot of tutorials seem to allude to.
Seems like a problem with the path for your scripts. Are you sure You have included your scripts in the PATH variable? If so are you sure your libraries are downloading/installing in that path?

airflow error:AttributeError: module 'airflow.utils.log' has no attribute 'file_processor_handler'

My local airflow instant was up and running, but now when I run airflow webserver or any other airflow command I got the below error (with some traceback):
Unable to load the config, contains a configuration error.
Traceback (most recent call last):
File "/anaconda3/lib/python3.6/logging/config.py", line 382, in resolve
found = getattr(found, frag)
AttributeError: module 'airflow.utils.log' has no attribute 'file_processor_handler'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/anaconda3/lib/python3.6/logging/config.py", line 384, in resolve
self.importer(used)
File "/anaconda3/lib/python3.6/site-packages/airflow/utils/log/file_processor_handler.py", line 25, in <module>
from airflow.utils.helpers import parse_template_string
File "/anaconda3/lib/python3.6/site-packages/airflow/utils/helpers.py", line 25, in <module>
import psutil
File "/anaconda3/lib/python3.6/site-packages/psutil/__init__.py", line 134, in <module>
from . import _psosx as _psplatform
File "/anaconda3/lib/python3.6/site-packages/psutil/_psosx.py", line 14, in <module>
from . import _psutil_osx as cext
ImportError: dlopen(/anaconda3/lib/python3.6/site-packages/psutil/_psutil_osx.cpython-36m-darwin.so, 2): Symbol not found: _kIOMasterPortDefault
Referenced from: /anaconda3/lib/python3.6/site-packages/psutil/_psutil_osx.cpython-36m-darwin.so
Expected in: flat namespace
in /anaconda3/lib/python3.6/site-packages/psutil/_psutil_osx.cpython-36m-darwin.so
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/anaconda3/lib/python3.6/logging/config.py", line 558, in configure
handler = self.configure_handler(handlers[name])
ValueError: Cannot resolve 'airflow.utils.log.file_processor_handler.FileProcessorHandler': dlopen(/anaconda3/lib/python3.6/site-packages/psutil/_psutil_osx.cpython-36m-darwin.so, 2): Symbol not found: _kIOMasterPortDefault
Referenced from: /anaconda3/lib/python3.6/site-packages/psutil/_psutil_osx.cpython-36m-darwin.so
Expected in: flat namespace
in /anaconda3/lib/python3.6/site-packages/psutil/_psutil_osx.cpython-36m-darwin.so
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/anaconda3/bin/airflow", line 21, in <module>
from airflow import configuration
File "/anaconda3/lib/python3.6/site-packages/airflow/__init__.py", line 36, in <module>
from airflow import settings
File "/anaconda3/lib/python3.6/site-packages/airflow/settings.py", line 259, in <module>
configure_logging()
File "/anaconda3/lib/python3.6/site-packages/airflow/logging_config.py", line 72, in configure_logging
raise e
File "/anaconda3/lib/python3.6/site-packages/airflow/logging_config.py", line 67, in configure_logging
dictConfig(logging_config)
File "/anaconda3/lib/python3.6/logging/config.py", line 795, in dictConfig
dictConfigClass(config).configure()
I tried to upgrade the airflow but that didn't help
I just encountered the same issue as your mentioned.
I will facing the issue even I just import pandas lib.
The reason is I have some dag files name email.py. which is same as python internal lib name. the conflict lead to python stop work. After I rename the email.py to email_test.py.
The problem solved.
You can refer to the similar question. It is same issue and same solution.
ImportError : cannot import DAG airflow
If you like my answer , pls vote it.
See my comment in this PR https://github.com/apache/airflow/pull/3585
essentially pinning psutil to 4.4.2 will fix, as the latest version of psutil at 5.6.1 in this context fails for me on osx
I think the problem is that the install of pustil has a mix of old and new files.
The "Cannot resolve 'airflow.utils.log.file_processor_handler.FileProcessorHandler" part of the error message is just Airflow saying while trying to FileProcessorHandler we got this other error.
You should see the exact same error form running pyton -c "import psutil" which would entirely remove Airflow from the equation.
I think the fix is to totally uninstall psutil (if conda wasn't involved I'd say pip uninstall psutil) and then reinstall it. I think in this case I'd try a pip-uninstall and to uninstall it from however you install conda packages.

Spyder startup trouble

I have troubles to start Spyder.
This is the error message:
Traceback (most recent call last):
File "/Applications/anaconda3/bin/spyder", line 7, in
from spyder.app.start import main
File "/Applications/anaconda3/lib/python3.6/site-packages/spyder/app/start.py", line 27, in
from spyder.config.main import CONF
File "/Applications/anaconda3/lib/python3.6/site-packages/spyder/config/main.py", line 22, in
from spyder.config.user import UserConfig
File "/Applications/anaconda3/lib/python3.6/site-packages/spyder/config/user.py", line 26, in
from spyder.utils.programs import check_version
File "/Applications/anaconda3/lib/python3.6/site-packages/spyder/utils/programs.py", line 18, in
import subprocess
File "/Applications/anaconda3/lib/python3.6/subprocess.py", line 136, in
import _posixsubprocess
ImportError: dlopen(/Applications/anaconda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-darwin.so, 2): Symbol not found: __Py_set_inheritable_async_safe
Referenced from: /Applications/anaconda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-darwin.so
Expected in: flat namespace
in /Applications/anaconda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-darwin.so
Somebody have an idea of what's going on?
(Spyder maintainer here) To fix this you need to open Terminal.app and run there
conda update python python.app spyder
run
conda update --all
can solve this problem!

"No module named zlib" error anytime I use pip

I'm using terminal on mac, and anytime I attempt to use pip, I get the following error message telling me that it cannot find a module named zlib:
$ pip --version
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/__init__.py", line 27, in <module>
from . import urllib3
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 42, in <module>
from .response import HTTPResponse
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 3, in <module>
import zlib
ModuleNotFoundError: No module named 'zlib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/bin/pip", line 7, in <module>
from pip import main
File "/usr/local/lib/python3.6/site-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/__init__.py", line 62, in <module>
from .packages.urllib3.exceptions import DependencyWarning
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/__init__.py", line 29, in <module>
import urllib3
File "/usr/local/lib/python3.6/site-packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 36, in <module>
from .response import HTTPResponse
File "/usr/local/lib/python3.6/site-packages/urllib3/response.py", line 3, in <module>
import zlib
ModuleNotFoundError: No module named 'zlib'
I've read several SO posts with the same error message, and have tried their solutions, including attempting to install zlib using homebrew, which fails, and updating my Xcode developer tools. I also installed pip earlier using python get-pip.py, and it said it installed successfully.
The reason I need pip is to install a package for use on python 2.7, but doing $ pip install "package-name" produces the same error as above. I have both Python 2 and 3 installed on my machine, if that helps. I'm kind of new to pip and using the command line in general, and I'm super confused; if anyone could help me out I'd really appreciate it.
This is the OP. I was able to fix the issue, and wanted to post my solution here in case it would help others.
Essentially I believe it occurred because Python2 is default on my machine, but pip is by default pointing to resources pertaining to Python3, or something like that. Doing pip2 --version instead provided the expected response.

Categories

Resources