0

I am using python 3.11. I was setting up a remote development enviornment and the anaconda distribution was just messing everything up. In order to get it to work I had to uninstall the conda distribution. Now that I have gotten the remote enviornment to work my computer is messed up. I cannot write python commands like which python in the Terminal. but I can use pip in the terminal. I have a script with the distfit package loaded but it will no longer import into spyder despite being able to use it from the terminal.

pip install distfit
/Applications/Spyder.app/Contents/MacOS/python: No module named pip
Note: you may need to restart the kernel to use updated packages.

I have tried to add the Path of the python site-packages folder but everytime i try to add it spyder crashes and does not save it.

Traceback (most recent call last):
  File "/Applications/Spyder.app/Contents/Resources/lib/python3.9/spyder/plugins/pythonpath/widgets/pathmanager.py", line 169, in <lambda>
    triggered=lambda x: self.add_path())
  File "/Applications/Spyder.app/Contents/Resources/lib/python3.9/spyder/plugins/pythonpath/widgets/pathmanager.py", line 456, in add_path
    if self.listwidget.row(self.user_header) < 0:
RuntimeError: wrapped C/C++ object of type QListWidgetItem has been deleted

I have reinstalled python a few times as well as spyder and I cannot find any answers.

d3hero23
  • 380
  • 1
  • 12

1 Answers1

0

This is my post and I found a solution after a long time but it involves many steps.

see the github post below:

'''

Working with other environments and Python installations
If you have an existing, pre-configured environment (such as for Keras or TensorFlow), are managing multiple environments (such as for development or testing purposes), or even would like to work within a totally separate Python installation as that in which Spyder is installed (such as a standalone installer Spyder with a separate Anaconda installation, or vice-versa), you can install the modular spyder-kernels package into any Python environment (conda environment, virtualenv/venv, system Python, WinPython, etc) in which you wish to work, and then change the Python interpreter used by Spyder on its IPython consoles to point to the Python executable of that environment.

This takes a small amount of preparation and configuration, but is much "lighter" and quicker than a full Spyder installation into that environment, avoids dependency conflicts, and opens up new workflow possibilities.

To achieve this, follow these steps:

Activate the environment (e.g. myenv) in which you'd like to work (e.g. with conda activate myenv for conda, source myenv/bin/activate or workon myenv for virtualenv/venv, etc)

Install the spyder-kernels package there, with the command:

conda install spyder-kernels if using conda/Anaconda,

pip install spyder-kernels if using pip/virtualenv.

After installing via either method, run the following command inside the same environment:

python -c "import sys; print(sys.executable)"
and copy the path returned by that command (it should end in python, pythonw, python.exe or pythonw.exe, depending on your operating system).

Deactivate that environment, activate the one in which Spyder is installed (if you've installed it in its own environment) and start Spyder as you normally would.

After Spyder has started, navigate to Preferences > Python Interpreter > Use the following interpreter and paste the path from Step 3 into the text box.

Start a new IPython console. All packages installed in your myenv environment should be available there. If conda is used, the name of the current environment and its Python version should be displayed in Spyder's status bar, and hovering over it should display the path of the selected interpreter.

'''

The only thing I did differently is I had to download miniconda enviornment. I then put the miniconda PATH at the end of my .zshrc file. They are wierd if statements and if you have other development enviornments set up it wont interfere if added after the other export path statements. Also, using homebrew to install the packages worked better than pip bc I was having issues with pip.

d3hero23
  • 380
  • 1
  • 12