How to start Spyder in macOS? - macos

I've installed python3.6 as below but unsure how to access Spyder. Most of what I have read is unclear, i.e. saying if should already have Spyder? I have completed my set-up using Learn Python the Hard Way on a Macbook Pro.
Install instruction: Gotohttps://www.python.org/downloads/release/python-360/anddownloadthe”macOS64-bit/32- bit installer”. Install it like you would any other software.
Terminal > Python version:
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Any help appreciated.
Steve

(Spyder maintainer here) Using Spyder is very simple, but not the way you're trying to do it.
Please remove what you've installed so far. Then simply download and install Anaconda. After that, look for an application called Anaconda Navigator with Spotlight and finally start Spyder from it.
Note: The way you're trying to install Spyder (by using pip on a Python version you downloaded from Python.org) is only recommended to very knowledgeable people because it's really hard to get all Spyder dependencies installed correctly and without problems. That's why we recommend to use Anaconda instead, which is way easier and safer.

Related

Anaconda3 Installation on Ubuntu 21, on Raspberrypi 4

I am following instructions to teach myself qiskit (Quantum computing developer Kit) from https://qiskit.org/documentation/getting_started.html, which requires Anaconda 3. For this learning exercise I plan to use a RPi4 running Ubuntu 21.X on it. I installed 64-Bit (AWS Graviton2 / ARM64) Installer (413 M). The installation hit a block when at the prompt to initialize conda , I get an error: line 477: 5128 Illegal instruction $PREFIX/bin/conda init which is further described as an open issue here on GitHub.
Would like to know if anyone have had success with Anaconda on RPi4b and even better, have been able to use qiskit on any OS. [I see the mambaforge / mini forge options but I am not sure qiskit is going to be compatible for conda versions provided by mamba/miniforge.]
Thank you.
You can't use Anaconda installer on RPi4 as it was compiled for AWS Graviton2 architecture.
Have you tried miniforge? It should work fine on RPi4

How can I run both TensorFlow and Torch on Mac M1 MacBook Pro?

I encounter some problems on my MacBook Pro M1. I thought it would be easier to start coding on it, apparently it's not a ML beast yet...
I need to use both PyTorch and TensorFlow on Python. I have installed TensorFlow 2.0 for Mac OS.
The problem is: TensorFlow won't work when you use a x86_64 terminal. (So it doesn't work with PyCharm). However, I can import TensorFlow 2.0 from an arm terminal.
Paradoxically, PyTorch won't install on a arm terminal, only on a x86_64 terminal. So, on the same Python terminal, I'm not able to import both torch and TensorFlow 2.0.
Since HuggingFace transformers is crucial for me, and transformers needs both TensorFlow 2.0 and PyTorch, I need to go back on my old computer to code. I'm very disappointed!
Anyone successfully imported both PyTorch and TensorFlow on a Mac M1 device?
And does anyone know if there is a way to force PyCharm to use an arm terminal, so I can use TensorFlow 2.0 on PyCharm on my M1 MPB?
Thank you!
After some research, I found this answer: https://github.com/pytorch/pytorch/issues/48145 .
So if someone tries to run both Tensorflow and Torch on Mac M1 with PyCharm Apple Silicon Version, here's how to proceed:
Create a new virtual env with Tensorflow Mac OS
From terminal (not from PyCharm, I got an error), with sudo rights, install the whl file for torch, from the GitHub issue: https://github.com/wizyoung/AppleSiliconSelfBuilds/blob/main/builds/torch-1.8.0a0-cp39-cp39-macosx_11_0_arm64.whl
Now you can open a PyCharm project with your freshly created virtual environment, and you'll be able to import both Tensorflow and Torch. However, a lot of librairies will be tricky to install like PyTorch...
Try building from the source code as I was able to install on my MacBook pro 13 M1.
PyTorch installation from source
Now you can pip install PyTorch for Macs with M1!
https://pytorch.org/blog/introducing-accelerated-pytorch-training-on-mac/
You basically need to use this
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
and replace "cuda" with "mps" in your code

pip install cx_Freeze-5.0.2-cp36-cp36m-win_amd64.whl to my window 10 machine

Tryng to pip install cx_Freeze using:
python -m pip install c:\Users\yosief\Downloads\cx_Freeze-5.0.2-cp36-cp36m-win_amd64.whl
on Window 10 based laptop and I end up with an error
cx_Freeze-5.0.2-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform
There are several reasons why you may not be able to install cx_Freeze but luckily it is generally easy to correct.
You should just be able to install cx_Freeze with pip install cx_Freeze. No need to download the wheel.
However if you want to use the wheel file. You should know have downloaded the x64 version for Python 3.6. Your Python installation must be an x64 build and the Python version 3.6.
Check the Python version and build by opening the Python interpreter. The version will be displayed at the top as well as the build.
For example on my PC the interpreter reads:
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
So I know the version is 3.6.3 and is 32 bit (MSC v.1900 32 bit). Take no notice of on win32 it does not give you the right windows build in some cases.
If the build or version is different from what you have downloaded then you must re download the wheel to match the Python build and version.
Then install the wheel file as you did above.

How do I change my default python path for the terminal for windows?

I am trying to install some python modules that are only for 2.x (like mechanize 'tried using pip, easy_install, even running the setup.py'). However, the modules are not showing up for me. I believe this is because I have a few versions of python installed for windows, and the default installation for the terminal is different than my PyCharm Project Interpreter:
My PyCharm project uses the project interpreter: 2.7.10 (C:\Python27\python.exe)
When I type into the terminal of PyCharm:
py -2.7
It calls this version: Enthought Canopy Python 2.7.9 | 64-bit | (default, Jul 1 2015, 03:41:50) [MSC v.1500 64 bit (AMD64)] on win32
However, I have a version of python that is 2.7.10. If I call
py -2.7.10
I get: Unknown Option: -2
Did my path for python 2.7.10 get written over by Enthought Canopy Python 2.7.9? How do I change my terminal python so I can install the appropriate files to run my PyCharm project with project interpreter: 2.7.10 (C:\Python27\python.exe)?
Thank you
The best way to go about going this would be to create a virtual environment (called virtualenv). This is the best link to get you started
Otherwise, open PyCharm, File>>Default Settings>>Project Interpreter>>Select the Interpreter you want to install the packages to, press the red '+' sign to the right, search the package and install.

Has anyone successfully built a PyObjC app in Snow Leopard?

If you did, would you mind sharing how you did the pyobjc install? I was trying to do it by installing PythonMac 2.5 (for the standalone bundle thru py2app), and doing easy_install of PyObjC. I always get those deprecated errors, primarily those declared in dyld.h, and inside objc_inject.m.
I tried compiling from source but still no luck.
Also, when I run my Leopard-compiled PyObjC app under Snow Leopard, it has errors concerning PyObjC, first time was it can't see Foundation or AppKit, second was typestr is unknown.
Thanks and appreciate your answers.
If you install the XCode Developer tools (optional Snow Leopard install), there's no need to manually install PyObjC at all. Here's how you can test it:
$ python
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Foundation
>>> Foundation.NSString.stringWithString_(u'hello PyObjC')
u'hello PyObjC'
>>>
If the Foundation, AppKit, ScriptingBridge, modules can be imported, then everything is alright.
I already found a way... though I dunno if this is official or what...
I downloaded 2.5 version of PythonMac, installed it, and then added a symlink inside the installation directory, e.g.:
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python /Library/Frameworks/Python.framework/Versions/2.5/lib/site-python
This part made it seem as if the bundled PyObjC binaries are part of the PythonMac installation, and when I do easy_install, the system site-packages won't get affected. Also, worth noting is that you shouldn't conflict the system-bundled py2app by easy_install-ing py2app or else you'll encounter a typestr error.
I wanna know if there's anything wrong with this for me to be able to make a standalone PyObjC application under Snow Leopard.

Resources