ipython doesn't get installed in the new env
Opened this issue · 6 comments
Solution to issue cannot be found in the documentation.
- I checked the documentation.
Issue
After $ mamba create -n pypyenv pypy numpy ipython
i activate the new pypyenv environment and after trying to run ipython i get
Traceback (most recent call last):
File "/home/ariel/miniforge-pypy3/envs/pypyenv/bin/ipython", line 6, in <module>
from IPython import start_ipython
File "/home/ariel/miniforge-pypy3/envs/pypyenv/lib/pypy3.9/site-packages/IPython/__init__.py", line 54, in <module>
from .terminal.embed import embed
File "/home/ariel/miniforge-pypy3/envs/pypyenv/lib/pypy3.9/site-packages/IPython/terminal/embed.py", line 16, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/home/ariel/miniforge-pypy3/envs/pypyenv/lib/pypy3.9/site-packages/IPython/terminal/interactiveshell.py", line 31, in <module>
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
File "/home/ariel/miniforge-pypy3/envs/pypyenv/lib/pypy3.9/site-packages/prompt_toolkit/__init__.py", line 25, in <module>
from .application import Application
File "/home/ariel/miniforge-pypy3/envs/pypyenv/lib/pypy3.9/site-packages/prompt_toolkit/application/__init__.py", line 3, in <module>
from .application import Application
File "/home/ariel/miniforge-pypy3/envs/pypyenv/lib/pypy3.9/site-packages/prompt_toolkit/application/application.py", line 20, in <module>
from ctypes import c_int, c_void_p, pythonapi
ImportError: cannot import name 'pythonapi' from 'ctypes' (/home/ariel/miniforge-pypy3/envs/pypyenv/lib/pypy3.9/ctypes/__init__.py)
what is wrong and how can it be worked around?
Installed packages
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_gnu conda-forge
asttokens 2.4.1 pyhd8ed1ab_0 conda-forge
bzip2 1.0.8 hd590300_5 conda-forge
ca-certificates 2023.11.17 hbcca054_0 conda-forge
decorator 5.1.1 pyhd8ed1ab_0 conda-forge
exceptiongroup 1.2.0 pyhd8ed1ab_0 conda-forge
executing 2.0.1 pyhd8ed1ab_0 conda-forge
expat 2.5.0 hcb278e6_1 conda-forge
gdbm 1.18 h0a1914f_2 conda-forge
ipython 8.18.1 pyh707e725_3 conda-forge
jedi 0.19.1 pyhd8ed1ab_0 conda-forge
libblas 3.9.0 20_linux64_openblas conda-forge
libcblas 3.9.0 20_linux64_openblas conda-forge
libexpat 2.5.0 hcb278e6_1 conda-forge
libffi 3.4.2 h7f98852_5 conda-forge
libgcc-ng 13.2.0 h807b86a_3 conda-forge
libgfortran-ng 13.2.0 h69a702a_3 conda-forge
libgfortran5 13.2.0 ha4646dd_3 conda-forge
libgomp 13.2.0 h807b86a_3 conda-forge
liblapack 3.9.0 20_linux64_openblas conda-forge
libopenblas 0.3.25 pthreads_h413a1c8_0 conda-forge
libsqlite 3.44.2 h2797004_0 conda-forge
libstdcxx-ng 13.2.0 h7e041cc_3 conda-forge
libxcb 1.15 h0b41bf4_0 conda-forge
libzlib 1.2.13 hd590300_5 conda-forge
matplotlib-inline 0.1.6 pyhd8ed1ab_0 conda-forge
ncurses 6.4 h59595ed_2 conda-forge
numpy 1.26.2 py39h6dedee3_0 conda-forge
openssl 3.2.0 hd590300_1 conda-forge
parso 0.8.3 pyhd8ed1ab_0 conda-forge
pexpect 4.8.0 pyh1a96a4e_2 conda-forge
pickleshare 0.7.5 py_1003 conda-forge
pip 23.3.2 pyhd8ed1ab_0 conda-forge
prompt-toolkit 3.0.42 pyha770c72_0 conda-forge
pthread-stubs 0.4 h36c2ea0_1001 conda-forge
ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge
pure_eval 0.2.2 pyhd8ed1ab_0 conda-forge
pygments 2.17.2 pyhd8ed1ab_0 conda-forge
pypy 7.3.13 0_pypy39 conda-forge
pypy3.9 7.3.13 h9557127_1 conda-forge
python 3.9.18 0_73_pypy conda-forge
python_abi 3.9 4_pypy39_pp73 conda-forge
readline 8.2 h8228510_1 conda-forge
setuptools 68.2.2 pyhd8ed1ab_0 conda-forge
six 1.16.0 pyh6c4a22f_0 conda-forge
sqlite 3.44.2 h2c6b66d_0 conda-forge
stack_data 0.6.2 pyhd8ed1ab_0 conda-forge
tk 8.6.13 noxft_h4845f30_101 conda-forge
traitlets 5.14.0 pyhd8ed1ab_0 conda-forge
typing_extensions 4.9.0 pyha770c72_0 conda-forge
tzdata 2023d h0c530f3_0 conda-forge
wcwidth 0.2.12 pyhd8ed1ab_0 conda-forge
wheel 0.42.0 pyhd8ed1ab_0 conda-forge
xorg-kbproto 1.0.7 h7f98852_1002 conda-forge
xorg-libx11 1.8.7 h8ee46fc_0 conda-forge
xorg-libxau 1.0.11 hd590300_0 conda-forge
xorg-libxdmcp 1.1.3 h7f98852_0 conda-forge
xorg-xextproto 7.3.0 h0b41bf4_1003 conda-forge
xorg-xproto 7.0.31 h7f98852_1007 conda-forge
xz 5.2.6 h166bdaf_0 conda-forge
zlib 1.2.13 hd590300_5 conda-forge
Environment info
active environment : pypyenv
active env location : /home/ariel/miniforge-pypy3/envs/pypyenv
shell level : 2
user config file : /home/ariel/.condarc
populated config files : /home/ariel/miniforge-pypy3/.condarc
conda version : 23.3.1
conda-build version : not installed
python version : 3.9.17.final.0
virtual packages : __archspec=1=x86_64
__glibc=2.36=0
__linux=6.1.0=0
__unix=0=0
base environment : /home/ariel/miniforge-pypy3 (writable)
conda av data dir : /home/ariel/miniforge-pypy3/etc/conda
conda av metadata url : None
channel URLs : https://conda.anaconda.org/conda-forge/linux-64
https://conda.anaconda.org/conda-forge/noarch
package cache : /home/ariel/miniforge-pypy3/pkgs
/home/ariel/.conda/pkgs
envs directories : /home/ariel/miniforge-pypy3/envs
/home/ariel/.conda/envs
platform : linux-64
user-agent : conda/23.3.1 requests/2.31.0 PyPy/3.9.17 Linux/6.1.0-16-amd64 debian/12 glibc/2.36
UID:GID : 1000:1000
netrc file : None
offline mode : False
1:) Update Conda
conda update conda
2:) New Virtual Environment:
conda create -n my_new_env python=3.9
conda activate my_new_env
pip install ipython
Replace my_new_env with the desired name for your new virtual environment.
You can activate your environment using the
conda activate
3:) Reinstall IPython:
pip install --upgrade --force-reinstall ipython
Try all three options to see if any can fix it if not please let me know
$ conda update conda
gives
Traceback (most recent call last):
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/exceptions.py", line 1132, in __call__
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/cli/main.py", line 69, in main_subshell
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/cli/conda_argparse.py", line 122, in do_call
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/notices/core.py", line 121, in wrapper
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/cli/main_update.py", line 20, in execute
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/cli/install.py", line 210, in install
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/core/prefix_data.py", line 125, in get
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/core/prefix_data.py", line 162, in _prefix_records
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/common/io.py", line 84, in decorated
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/core/prefix_data.py", line 66, in load
OSError: [Errno 24] Too many open files: b'/home/ariel/miniforge-pypy3/conda-meta'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ariel/miniforge-pypy3/bin/conda", line 13, in <module>
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/cli/main.py", line 112, in main
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/exceptions.py", line 1432, in conda_exception_handler
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/exceptions.py", line 1135, in __call__
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/exceptions.py", line 1175, in handle_exception
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/exceptions.py", line 1186, in handle_unexpected_exception
File "/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/exceptions.py", line 1248, in print_unexpected_error_report
OSError: [Errno 24] Too many open files: '/home/ariel/miniforge-pypy3/lib/pypy3.9/site-packages/conda/cli/main_info.py'
"OSError: [Errno 24] this can happen when there are too many file handles open simultaneously, which is common when Conda is managing packages and environments.
Use tools like htop or top to identify any resource-hungry programs or processes that might be causing the issue. Terminate any unnecessary or problematic processes.
Increase File Limits: You can increase the file limits for your user or system to allow more open files. This can usually be done by modifying system limits in the /etc/security/limits.conf file or by using the ulimit command.
Restart Your System: In some cases, a simple system restart can help resolve issues related to file handle limits.
Clean Conda Cache: Over time, Conda can accumulate cache files that consume file handles. You can try cleaning Conda's cache by running the following command: conda clean --all
let me know if the problem continues or fixes
I rebooted the system - the error repeated.
Then i tried conda clean --all
- it worked.
The result of conda update conda
is as follows
==> WARNING: A newer version of conda exists. <==
current version: 23.3.1
latest version: 23.11.0
Please update conda by running
$ conda update -n base -c conda-forge conda
Or to minimize the number of packages updated during conda update use
conda install conda=23.11.0
# All requested packages already installed.
However, trying to conda install conda=23.11.0
leads to system deadlock probably given poor power of my very old PC. Thus i'm much interested in working with mamba instead of conda.
mamba update mamba
updates the packages but finishes with the same OSError , which is eliminated by
mamba clean --all
Afterwards, trying
mamba create -n pypyenv pypy` # i was seeking an env with pypy as python interpreter
mamba activate pypyenv
pip install ipython
works well.
Is it the only way to workaround ? Is using pip in conda env ok? Normally it's being said that conda or mamba are preferable.
try:
conda config --add channels conda-forge
conda update conda
It succeeded. Thank you.