I have a relatively fresh installation of anaconda, in which I installed rpy2 using "conda install rpy2". However, when I try running it, I get this error, e.g.:
> /[dir]/anaconda/bin/python -m 'rpy2.tests'
Traceback (most recent call last):
File "/[dir]/anaconda/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/[dir]/anaconda/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "[dir]/anaconda/lib/python2.7/site-packages/rpy2/tests.py", line 23, in <module>
import rpy2.tests_rpy_classic
File "/[dir]/anaconda/lib/python2.7/site-packages/rpy2/tests_rpy_classic.py", line 3, in <module>
import rpy2.rpy_classic as rpy
File "/[dir]/anaconda/lib/python2.7/site-packages/rpy2/rpy_classic.py", line 5, in <module>
import rpy2.rinterface as ri
File "/[dir]/anaconda/lib/python2.7/site-packages/rpy2/rinterface/__init__.py", line 92, in <module>
from rpy2.rinterface._rinterface import (baseenv,
ImportError: libiconv.so.2: cannot open shared object file: No such file or directory
What is this libiconv.so.2, and why doesn't it work straight from the box?
I think you need to conda install -c r libiconv or perhaps install r-essentials, which contains libiconv.
Related
I try to activate my env to Jupyter notebook by using:
python -m ipykernel install --user --name native --display-name "python-gpu"
But error message:
Traceback (most recent call last):
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/site-packages/ipykernel/__main__.py", line 2, in <module>
from ipykernel import kernelapp as app
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/site-packages/ipykernel/kernelapp.py", line 18, in <module>
from IPython.core.application import (
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/site-packages/IPython/__init__.py", line 53, in <module>
from .terminal.embed import embed
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/site-packages/IPython/terminal/embed.py", line 15, in <module>
from IPython.core.interactiveshell import DummyMod, InteractiveShell
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 73, in <module>
from IPython.core.history import HistoryManager
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/site-packages/IPython/core/history.py", line 11, in <module>
import sqlite3
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/sqlite3/__init__.py", line 57, in <module>
from sqlite3.dbapi2 import *
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: dlopen(/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/lib-dynload/_sqlite3.cpython-310-darwin.so, 0x0002): Symbol not found: _sqlite3_enable_load_extension
Referenced from: /Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/lib-dynload/_sqlite3.cpython-310-darwin.so
Expected in: /usr/lib/libsqlite3.dylib
It seems like something is wrong with my libsqlite3, but it goes well in my terminal.
My laptop is a Macbook pro with M1Pro. And I'm building an arm64 python environment in M1 version Anaconda.
Does anyone know how I can get around this?
I had the same problem and I solved by installing a newer version:
mamba install sqlite=3.40.0
always checking that the new library is coming from conda-forge/osx-arm64.
I installed Anaconda3 on ubuntu and changed the path to ~/anaconda/bin in .bashrc file then I'm trying to install keras It's throwing this error.
hemanth#specter:~$ python3 -m pip install keras
Traceback (most recent call last):
File "/home/hemanth/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/home/hemanth/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/hemanth/anaconda3/lib/python3.7/site-packages/pip/__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "/home/hemanth/anaconda3/lib/python3.7/site-packages/pip/_internal/__init__.py", line 19, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "/home/hemanth/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/home/hemanth/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/connectionpool.py", line 7, in <module>
from socket import error as SocketError, timeout as SocketTimeout
File "/home/hemanth/anaconda3/lib/python3.7/socket.py", line 49, in <module>
import _socket
ModuleNotFoundError: No module named '_socket'
I tried this command and it is working fine.
however, try to install socket using pip install sockets and then again try installing keras.
I want to create exe from a py script using pyinstaller. I wrote the following command in cmd "pyinstaller --onefile --windowed filename.py", but there is an error showed by the cmd. How do I solve this?
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pyinstaller.exe\__main__.py", line 5, in <module>
File "c:\python27\lib\site-packages\PyInstaller\__main__.py", line 21, in <module>
import PyInstaller.building.build_main
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py", line 32, in <module>
from ..depend import bindepend
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line 38, in <module>
from ..utils.win32.winmanifest import RT_MANIFEST
File "c:\python27\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 97, in <module>
from PyInstaller.utils.win32 import winresource
File "c:\python27\lib\site-packages\PyInstaller\utils\win32\winresource.py", line 20, in <module>
import pywintypes
ImportError: No module named pywintypes
Edit: I have tried to "pip install pypiwin32, but still got the same ImportError
You should try to work in a virtualenv if you are on Windows. I recommand Anaconda. You will be able to easily install most of python packages.
Once Anaconda is installed, just run conda install -c conda-forge pyinstaller=3.2.1
and you should be fine.
Hope this helps.
In some case you have to manually mention modules that need to be packes through the keyword "--hidden-import
So in your case:
pyinstaller --onefile --hidden-import=pywintypes --windowed filename.py
I installed Python 3.4.0, but I can't use pip. So then I installed pip from python.org. Then I set PATH.
when I use pip, it reports these:
C:\Users\think\Downloads\pip-7.1.2>pip
Traceback (most recent call last):
File "C:\Python34\lib\runpy.py", line 171, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python34\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
...
File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\conn
ectionpool.py", line 33, in <module>
from .connection import (
File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\conn
ection.py", line 41, in <module>
from .util import (
File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\util
\__init__.py", line 5, in <module>
from .ssl_ import (
File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\util
\ssl_.py", line 4, in <module>
from ..exceptions import SSLError, InsecurePlatformWarning
ImportError: cannot import name 'InsecurePlatformWarning'
Python3.4.0 on Win32
Please assure that you are running pip module that was intalled in the include path of your python version.
You can do this via python -m pip install <somemodule>. If this fails you probably do not have the right module.
Also, you may want to install the modules for current user only, by using python -m pip install --user <somemodule>
I used pip uninstall on shapely and got an exception, which I did not save.
Since then every pip or easy install command will pop this exception :
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pip.exe\__main__.py", line 5, in <module>
File "C:\Python27\lib\site-packages\pip\__init__.py", line 13, in <module>
from pip.utils import get_installed_distributions, get_prog
File "C:\Python27\lib\site-packages\pip\utils\__init__.py", line 17, in <module>
from pip.compat import console_to_str, stdlib_pkgs
File "C:\Python27\lib\site-packages\pip\compat\__init__.py", line 14, in <module>
from pip.compat.dictconfig import dictConfig as logging_dictConfig
File "C:\Python27\lib\site-packages\pip\compat\dictconfig.py", line 22, in <module>
import logging.handlers
File "C:\Python27\lib\logging\handlers.py", line 27, in <module>
import logging, socket, os, cPickle, struct, time, re
File "C:\Python27\lib\socket.py", line 47, in <module>
import _socket
ImportError: No module named _socket
Any ideas?
See this bug.
Off the top, pip uninstall shapely seems to be removing the top dlls from the Python installations. This is why you see the error on every pip command after.