Closed IvanLiuTW closed 2 years ago
dependencies:
Mandatory: applaunchservices >=0.1.7 : 0.2.1 (OK) atomicwrites >=1.2.0 : 1.4.0 (OK) chardet >=2.0.0 : 4.0.0 (OK) cloudpickle >=0.5.0 : 1.6.0 (OK) cookiecutter >=1.6.0 : 1.7.3 (OK) diff_match_patch >=20181111 : 20200713 (OK) intervaltree >=3.0.2 : 3.1.0 (OK) IPython >=7.6.0 : 7.27.0 (OK) jedi >=0.17.2;<0.19.0 : 0.18.0 (OK) jsonschema >=3.2.0 : 3.2.0 (OK) keyring >=17.0.0 : 23.1.0 (OK) nbconvert >=4.0 : 6.1.0 (OK) numpydoc >=0.6.0 : 1.1.0 (OK) parso >=0.7.0;<0.9.0 : 0.8.2 (OK) pexpect >=4.4.0 : 4.8.0 (OK) pickleshare >=0.4 : 0.7.5 (OK) psutil >=5.3 : 5.8.0 (OK) pygments >=2.0 : 2.10.0 (OK) pylint >=2.5.0;<2.10.0 : 2.9.6 (OK) pyls_spyder >=0.4.0 : 0.4.0 (OK) pylsp >=1.2.2;<1.3.0 : 1.2.2 (OK) pylsp_black >=1.0.0 : None (OK) qdarkstyle =3.0.2 : 3.0.2 (OK) qstylizer >=0.1.10 : 0.2.1 (OK) qtawesome >=1.0.2 : 1.0.3 (OK) qtconsole >=5.1.0 : 5.1.1 (OK) qtpy >=1.5.0 : 1.10.0 (OK) rtree >=0.9.7 : 0.9.7 (OK) setuptools >=49.6.0 : 57.4.0 (OK) sphinx >=0.6.6 : 4.1.2 (OK) spyder_kernels >=2.1.1;<2.2.0 : 2.1.1 (OK) textdistance >=4.2.0 : 4.2.1 (OK) three_merge >=0.1.1 : 0.1.1 (OK) watchdog >=0.10.3 : 2.1.5 (OK) zmq >=17 : 22.2.1 (OK)
Optional: cython >=0.21 : 0.29.24 (OK) matplotlib >=2.0.0 : 3.4.3 (OK) numpy >=1.7 : 1.21.2 (OK) pandas >=1.1.1 : 1.3.2 (OK) scipy >=0.17.0 : 1.7.1 (OK) sympy >=0.7.3 : 1.8 (OK)
Hey @IvanLiuTW, thanks for reporting. Tkinter seems to be causing a segfault in the kernel.
@mrclary, could you take a look at this one?
Thanks for the quick reply. I really appreciate your help!
I'm sorry. Another report. As the dependencies I showed, I have installed the rtree package. But.. I'm wondering why I still keep receiving this error message?
@IvanLiuTW, I'm afraid I don't have enough information to reproduce your original error.
$ conda list
ok, no problem! Thanks for your help.
The picture shows the code I ran.
$ conda list
Last login: Fri Sep 3 22:06:30 on ttys000
(base) ivanliu@liujiayoudeMac-mini ~ % conda list
packages in environment at /Users/ivanliu/opt/miniconda3:
Name Version Build Channel
anyio 3.3.0 py39h6e9494a_0 conda-forge
appnope 0.1.2 py39h6e9494a_1 conda-forge
argon2-cffi 20.1.0 py39h89e85a6_2 conda-forge
async_generator 1.10 py_0 conda-forge
attrs 21.2.0 pyhd8ed1ab_0 conda-forge
babel 2.9.1 pyh44b312d_0 conda-forge
backcall 0.2.0 pyh9f0ad1d_0 conda-forge
backports 1.0 py_2 conda-forge
backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge
bleach 4.1.0 pyhd8ed1ab_0 conda-forge
boto3 1.18.31 pypi_0 pypi
botocore 1.21.31 pypi_0 pypi
brotlipy 0.7.0 py39h9ed2024_1003
ca-certificates 2021.7.5 hecd8cb5_1
certifi 2021.5.30 py39hecd8cb5_0
cffi 1.14.6 py39h2125817_0
chardet 4.0.0 py39hecd8cb5_1003
cloudpickle 1.6.0 pypi_0 pypi
conda 4.10.3 py39hecd8cb5_0
conda-package-handling 1.7.3 py39h9ed2024_1
cryptography 3.4.7 py39h2fd3fbb_0
cycler 0.10.0 pypi_0 pypi
debugpy 1.4.1 pypi_0 pypi
decorator 5.0.9 pyhd8ed1ab_0 conda-forge
defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge
entrypoints 0.3 pyhd8ed1ab_1003 conda-forge
idna 2.10 pyhd3eb1b0_0
importlib-metadata 4.8.1 py39h6e9494a_0 conda-forge
ipykernel 6.2.0 pypi_0 pypi
ipython 7.27.0 py39h71a6800_0 conda-forge
ipython-genutils 0.2.0 pypi_0 pypi
ipython_genutils 0.2.0 py_1 conda-forge
jedi 0.18.0 py39h6e9494a_2 conda-forge
jinja2 3.0.1 pyhd8ed1ab_0 conda-forge
jmespath 0.10.0 py_0
joblib 1.0.1 pypi_0 pypi
json5 0.9.5 pyh9f0ad1d_0 conda-forge
jsonschema 3.2.0 pyhd8ed1ab_3 conda-forge
jupyter-client 7.0.1 pypi_0 pypi
jupyter_client 7.0.2 pyhd8ed1ab_0 conda-forge
jupyter_core 4.7.1 py39h6e9494a_0 conda-forge
jupyter_server 1.10.2 pyhd8ed1ab_0 conda-forge
jupyterlab 3.1.10 pyhd8ed1ab_0 conda-forge
jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge
jupyterlab_server 2.7.2 pyhd8ed1ab_0 conda-forge
kiwisolver 1.3.2 pypi_0 pypi
libcxx 10.0.0 1
libffi 3.3 hb1e8313_2
libsodium 1.0.18 hbcb3906_1 conda-forge
libspatialindex 1.9.3 h23ab428_0
markupsafe 2.0.1 py39h89e85a6_0 conda-forge
matplotlib 3.4.3 pypi_0 pypi
matplotlib-inline 0.1.2 pyhd8ed1ab_2 conda-forge
mistune 0.8.4 py39h89e85a6_1004 conda-forge
nbclassic 0.3.1 pyhd8ed1ab_1 conda-forge
nbclient 0.5.4 pyhd8ed1ab_0 conda-forge
nbconvert 6.1.0 py39h6e9494a_0 conda-forge
nbformat 5.1.3 pyhd8ed1ab_0 conda-forge
ncurses 6.2 h0a44026_1
nest-asyncio 1.5.1 pyhd8ed1ab_0 conda-forge
notebook 6.4.3 pyha770c72_0 conda-forge
numpy 1.21.2 pypi_0 pypi
opencv-python 4.5.3.56 pypi_0 pypi
openssl 1.1.1l h9ed2024_0
packaging 21.0 pyhd8ed1ab_0 conda-forge
pandas 1.3.2 pypi_0 pypi
pandoc 2.14.2 h0d85af4_0 conda-forge
pandocfilters 1.4.2 py_1 conda-forge
parso 0.8.2 pyhd8ed1ab_0 conda-forge
patsy 0.5.1 pypi_0 pypi
pexpect 4.8.0 pyh9f0ad1d_2 conda-forge
pickleshare 0.7.5 py_1003 conda-forge
pillow 8.3.1 pypi_0 pypi
pip 21.1.3 py39hecd8cb5_0
prometheus_client 0.11.0 pyhd8ed1ab_0 conda-forge
prompt-toolkit 3.0.20 pyha770c72_0 conda-forge
ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge
pycosat 0.6.3 py39h9ed2024_0
pycparser 2.20 py_2
pygments 2.10.0 pyhd8ed1ab_0 conda-forge
pyopenssl 20.0.1 pyhd3eb1b0_1
pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge
pyrsistent 0.17.3 py39h89e85a6_2 conda-forge
pysocks 1.7.1 py39hecd8cb5_0
python 3.9.5 h88f2d9e_3
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python.app 3 py39h9ed2024_0
python_abi 3.9 2_cp39 conda-forge
pytz 2021.1 pyhd8ed1ab_0 conda-forge
pyzmq 22.2.1 py39h23ab428_1
readline 8.1 h9ed2024_0
requests 2.25.1 pyhd3eb1b0_0
requests-unixsocket 0.2.0 py_0 conda-forge
rtree 0.9.7 py39hecd8cb5_1
ruamel_yaml 0.15.100 py39h9ed2024_0
s3transfer 0.5.0 pyhd3eb1b0_0
scikit-learn 0.24.2 pypi_0 pypi
scipy 1.7.1 pypi_0 pypi
seaborn 0.11.2 pypi_0 pypi
send2trash 1.8.0 pyhd8ed1ab_0 conda-forge
setuptools 52.0.0 py39hecd8cb5_0
six 1.16.0 pyhd3eb1b0_0
sniffio 1.2.0 py39h6e9494a_1 conda-forge
spyder-kernels 2.1.0 pypi_0 pypi
sqlite 3.36.0 hce871da_0
statsmodels 0.12.2 pypi_0 pypi
terminado 0.11.1 py39h6e9494a_0 conda-forge
testpath 0.5.0 pyhd8ed1ab_0 conda-forge
threadpoolctl 2.2.0 pypi_0 pypi
tk 8.6.10 hb0a8c7a_0
tornado 6.1 py39h89e85a6_1 conda-forge
tqdm 4.61.2 pyhd3eb1b0_1
traitlets 5.0.5 pypi_0 pypi
tzdata 2021a h52ac0ba_0
urllib3 1.26.6 pyhd3eb1b0_1
wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge
webencodings 0.5.1 py_1 conda-forge
websocket-client 0.57.0 py39h6e9494a_4 conda-forge
wheel 0.36.2 pyhd3eb1b0_0
wurlitzer 3.0.2 pypi_0 pypi
xz 5.2.5 h1de35cc_0
yaml 0.2.5 haf1e3a3_0
zeromq 4.3.4 h23ab428_0
zipp 3.5.0 pyhd8ed1ab_0 conda-forge
zlib 1.2.11 h1de35cc_3
...And you are trying to run the code using the conda base environment, correct? Can you confirm your interpreter settings for me? Preferences-> Python interpreter ? screen shot is okay.
Yes, I run the code under the conda base envrionment. Thank you.
Can you please copy/paste your code (not screen shot).
Also, I see that you have mixed pip and conda installations in your conda base environment. This is not good. There are several packages you have installed that should be installed through conda instead of pip. Your package pillow
depends on tk
, but pillow
is installed with pypi and tk
installed with conda. It's possible that pypi replaced your tk shared libraries, breaking what was installed with conda.
If your tk libraries are broken, then you may have to reinstall miniconda and reinstall packages from conda instead of pypi.
Yes, I see. I have tried many ways to fixed the problem and spent a long time. I really appreciate your help.
I'll try the uninstallation method you said. I'd like to ask that to deeply uninstall my miniconda, are the following command enough?
On the other hand, I am still getting used to Spyder. As you said, I should install packages through the command like conda ...
rather then pip ...
, no matter it's in terminal or Spyder kernel, isn't it?
the code as follows:
import tkinter as tk
window = tk.Tk()
top_frame = tk.Frame(window)
top_frame.pack()
bottom_frame = tk.Frame(window)
bottom_frame.pack(side=tk.BOTTOM)
def echo_hello():
print('hello world :)')
left_button = tk.Button(top_frame, text='Red', fg='red')
left_button.pack(side=tk.LEFT)
middle_button = tk.Button(top_frame, text='Green', fg='green')
middle_button.pack(side=tk.LEFT)
right_button = tk.Button(top_frame, text='Blue', fg='blue')
right_button.pack(side=tk.LEFT)
bottom_button = tk.Button(bottom_frame, text='Black', fg='black', command=echo_hello)
bottom_button.pack(side=tk.BOTTOM)
window.mainloop()
Many thanks.
Before you do anything drastic, let me test the code first.
Ok, I see. Thanks for your help.
It's very late here, so I'm afraid I won't be able to read your message.
I will reply as soon as I see your message.
Thanks a lot.
Yes, it is your environment installation. Create a new environment...
$ conda create -n test python=3.9.5 spyder-kernels=2.1
Change your interpreter to run with the newly created conda environment in Spyder's preferences. It runs fine on my machine.
If it runs fine on your machine with the newly created conda environment, then you don't need to reinstall miniconda. You only have to create another conda environment and use that (recommended). You may also try to clean up your base environment by removing as many pypi installations as possible and replace them with conda installations; but I don't know if that will work.
If the code still does not run on your machine in the newly created conda environment, or if you can't get the base environment to work and still want to use the base environment, then you will have to remove miniconda and reinstall it. This should be sufficient.
$ rm -r ~/minconda
Note that miniconda (and anaconda) has updated its install location from ~/miniconda to ~/opt/miniconda3.
@IvanLiuTW let me know how it goes. But I'm marking this issue as resolved.
jupyter-client 7.0.1 pypi_0 pypi jupyter_client 7.0.2 pyhd8ed1ab_0 conda-forge spyder-kernels 2.1.0 pypi_0 pypi
I think the problem was with jupyter-client 7. I added a constraint on spyder-kernels 2.1.1 to not pull it, but that was not available in version 2.1.0 (the one @IvanLiuTW had installed).
jupyter-client 7.0.1 pypi_0 pypi jupyter_client 7.0.2 pyhd8ed1ab_0 conda-forge spyder-kernels 2.1.0 pypi_0 pypi
I think the problem was with jupyter-client 7. I added a constraint on spyder-kernels 2.1.1 to not pull it, but that was not available in version 2.1.0 (the one @IvanLiuTW had installed).
Quite possible. My successful tests were using jupyter-client=6.1.12. Versions >7 are only available on the conda-forge channel at the moment.
@mrclary @ccordoba12 Thank you very much. I appreciate your help.
I'll try the method you recommended to see if it works. I will reply to you with the result as soon as I finish.
Thanks again.
(base) ivanliu@liujiayoudeMac-mini ~ % conda create -n new python=3.9.5 spyder-kernels=2.1
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- spyder-kernels=2.1
Current channels:
- https://repo.anaconda.com/pkgs/main/osx-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-64
- https://repo.anaconda.com/pkgs/r/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
(base) ivanliu@liujiayoudeMac-mini ~ % conda create -n new python=3.9.5 spyder-kernels=2.1.1
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- spyder-kernels=2.1.1
Current channels:
- https://repo.anaconda.com/pkgs/main/osx-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-64
- https://repo.anaconda.com/pkgs/r/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
As I tried to create a new environment, I got this response from my terminal.
Am I do something wrong?
Sorry, I didn't realize that spyder-kernels=2.1 is not on the main channel yet. You will have to include the conda-forge channel.
$ conda config --append channels conda-forge
$ conda create -n new python=3.9.5 spyder-kernels=2.1
Ok, I see. Thanks for the quick reply. Thank you very much!!
I'll try it.
Thank you very much. I created new conda environment successfully.
However, I still got the error message.
Could you post your conda list
for that env?
But! After I changed the Graphic setting in IPython console, I set the graphic backend to inline, and it works.😅
Ok, thank you!
conda list
(new) ivanliu@liujiayoudeMac-mini ~ % conda list
# packages in environment at /Users/ivanliu/opt/miniconda3/envs/new:
#
# Name Version Build Channel
appnope 0.1.2 py39hecd8cb5_1001
backcall 0.2.0 pyhd3eb1b0_0
ca-certificates 2021.7.5 hecd8cb5_1
certifi 2021.5.30 py39hecd8cb5_0
cloudpickle 1.6.0 py_0
debugpy 1.4.1 py39h23ab428_0
decorator 5.0.9 pyhd3eb1b0_0
ipykernel 6.2.0 py39hecd8cb5_1
ipython 7.26.0 py39h01d92e1_0
ipython_genutils 0.2.0 pyhd3eb1b0_1
jedi 0.18.0 py39hecd8cb5_1
jupyter_client 6.1.12 pyhd3eb1b0_0
jupyter_core 4.7.1 py39hecd8cb5_0
libcxx 10.0.0 1
libffi 3.3 hb1e8313_2
libsodium 1.0.18 h1de35cc_0
matplotlib-inline 0.1.2 pyhd3eb1b0_2
ncurses 6.2 h0a44026_1
openssl 1.1.1l h9ed2024_0
parso 0.8.2 pyhd3eb1b0_0
pexpect 4.8.0 pyhd3eb1b0_3
pickleshare 0.7.5 pyhd3eb1b0_1003
pip 21.2.4 py37hecd8cb5_0
prompt-toolkit 3.0.17 pyh06a4308_0
ptyprocess 0.7.0 pyhd3eb1b0_2
pygments 2.10.0 pyhd3eb1b0_0
python 3.9.5 h88f2d9e_3
python-dateutil 2.8.2 pyhd3eb1b0_0
python_abi 3.9 2_cp39 conda-forge
pyzmq 22.2.1 py39h23ab428_1
readline 8.1 h9ed2024_0
setuptools 52.0.0 py39hecd8cb5_0
six 1.16.0 pyhd3eb1b0_0
spyder-kernels 2.1.1 py39h6e9494a_0 conda-forge
sqlite 3.36.0 hce871da_0
tk 8.6.10 hb0a8c7a_0
tornado 6.1 py39h9ed2024_0
traitlets 5.0.5 pyhd3eb1b0_0
tzdata 2021a h5d7bf9c_0
wcwidth 0.2.5 py_0
wheel 0.37.0 pyhd3eb1b0_0
wurlitzer 2.1.1 py39hecd8cb5_0
xz 5.2.5 h1de35cc_0
zeromq 4.3.4 h23ab428_0
zlib 1.2.11 h1de35cc_3
Ok, please downgrade to ipykernel 5 and try again. That could also help.
So, if I change the graphic backend setting, it would cause the tkinter interface not work properly?
Sorry, how do I degrade the ipykernel 5?
conda install ipykernel=5
@ccordoba12 Thank you!
It worked, even if I changed the graphic backend setting.
Because @mrclary suggested that I clean up my base environment by removing pypi installations, may I ask how to do it? Or I just remove my original base envrionment.
Again, @mrclary @ccordoba12 thanks for helping me resolve this issue.
I don't think the backend setting should matter. That is only for matplotlib. I'm I mistaken @ccordoba12 ?
It seems that a new environment demonstrates that it will work. Therefore I recommend creating an environment that you want to use and install all the packages that you want using conda. As a last resort only, if packages are not on conda, you may try to install them using pip; but this could lead to problems.
If you use a new environment then you don't need to clean up your base environment. However, if you want to clean it up, then you will have to uninstall all the packages that were installed with pip. Make sure that you are in your base environment, then
$ pip uninstall -q -y <package1> <package2> ...
then reinstall them with conda
$ conda install <package1> <package2> ...
Ok, I see. Thank you!! Really appreciate your help.
May I ask you a question not related to this issue?😅 I noticed that your memory usage is 66% while runnung Spyder, but mine is usually close to 90%. I've consulted official Apple team about it, and they said my the memory of my Mac works fine. May I ask you how to lower the memory usage while running Spyder? I use Mac mini with M1 chip.
That may be related to the M1 chip. I'll see if I can look into that some time.
@IvanLiuTW, please take into account that the memory consumption shown by Spyder is the one of your entire system, not that used by Spyder.
If you're training Pytorch models, I don't think it's surprising to see a 90% of consumption.
Thanks for reply!
Yes, I see. The reason why I'm wondering is becasue I haven't run any code when I start Spyder, and it's already shown 88% or 89%. I think it might be caused by M1 chip...
And... I got the error message again when I ran code written through matplotlib😅
I'm on a 24" iMac, Apple M1, 16G memory, OS 11.5.2. With only Spyder 5.1.2, Firefox, Terminal, and Activity Monitor open, and Spyder status bar shows 89% memory. But this does not accurately reflect the information shown in Activity monitor. There may be an issue with psutils on M1 Macs
If I tried to show the picture, the error message appear.
* Spyder version: 5.1.2 None
* Python version: 3.9.5 64-bit
* Qt version: 5.12.10
* PyQt5 version: 5.12.3
* Operating System: Darwin 20.6.0
the code I ran
import numpy as np
import matplotlib.pyplot as plt
import cv2
def aidemy_imshow(name, img):
b, g, r = cv2.split(img) #將各種通道(B, G, R)的資料拆解(split)出來
img = cv2.merge([r, g, b]) #依 R, G, B 的順序再次合併
plt.title(name) # 以 matplotlib 繪圖
plt.imshow(img) # 以 matplotlib 讀取圖片
plt.show() # 以 matplotlib 顯示圖片
cv2.imshow2 = aidemy_imshow #用 aidemy_imshow 的內容取代 cv2.imshow
img = cv2.imread('sample.jpg')
cv2.imshow('Sample pic', img)
cv2.imshow2('Sample pic', img)
the Sample pic
@mrclary
Oh my!!! Finally find someone has the same issue with me 🥲. I do have same 16G memory as yours, but I use Mac mini.
"This does not accurately reflect the information shown in Activity monitor. There may be an issue with psutils on M1 Macs" -> I totally agree with you. That's true and I have consulted with Apple teams many times, but they said that's fine...
I don't know that there is a problem. Only that the way memory usage is computed and reported is a bit convoluted, especially when considering swaps and virtual memory. So it may not be a problem, but just different, between M1 and Intel Macs.
Nevertheless, @ccordoba12, perhaps the memory reporting in our Status bar is a bit confusing. Shouldn't we report on Spyder's memory usage instead of the total system memory usage?
Got it. I see. Thank you!
Back to my issue.
I found that if I can show matplotlib picture, I could not show tkinter UGI, and vice versa. The solution now I used is to change the Graphic backend setting.
Shouldn't we report on Spyder's memory usage instead of the total system memory usage?
The tooltip says that it's the system global memory, but I understand it can be confusing to users. It shouldn't be that hard to use psutil
to get our memory along with the one from our children (pylsp and kernels).
I found that if I can show matplotlib picture, I could not show tkinter UGI, and vice versa. The solution now I used is to change the Graphic backend setting.
While testing this I found the cause of the problem. I'll try to fix it in the next release of spyder-kernels (see https://github.com/spyder-ide/spyder-kernels/pull/319).
OK, I see. Thank you.