Apache Superset : bad interpreter: No such file or directory - python-3.x

I created a new environment to run a superset dashboard, super_dash, I get an error bad interpreter: No such file or directory when I run it.Not able to do any activities.
I tried
To reinstall `pip install apache-superset', but the results seems to be same.
Install `pip install apache-superset' in a different environment, the result is still the same.
However when I run superset in my base environment there is no issue.
Please find the environment details
(super_dash) hashi-MacBook-Air:~ hashi$ which python
/Users/hashi/DG/env/super_dash/bin/python
(super_dash) hashi-MacBook-Air:~ hashi$ which python3
/Users/hashi/DG/env/super_dash/bin/python3
(super_dash) hashi-MacBook-Air:~ hashi$ which pip
/Users/hashi/DG/env/super_dash/bin/pip
Base version
(base) hashi-MacBook-Air:~ hashi$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
(base) hashi-MacBook-Air:~ hashi$ which python3
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3
(base) hashi-MacBook-Air:~ hashi$ which pip
/Library/Frameworks/Python.framework/Versions/2.7/bin/pip
Mac : macOS Catalina 10.15.7
Several issues available in the net
Wrong pointing of Python version
Issue with improper pip version / linkage
I basically understand from all these is that issue with the way python was installed.
Tried many solutions with no result.
Can anyone give me more clarity on this ?

I finally resolved the issue.
Root Cause : Multiple Python Versions
Solution :
install : 'python3 -m pip install apache-superset'
instead of superset run -p 8088
run python3 superset run -p 8088

Related

Unable to Install Jupyter due to legacy-install-error with psutil package

I was previously running into environment inconsistencies after downloading tensorflow with pip in a conda environment, and after several hours of frustration, decided deleting anaconda/miniconda and python and starting from scratch would be my best option to get python working again (The inconsistencies were causing a plethora of issues with loading other modules like numpy, etc).
After downloading Python version 3.9.10 directly from https://www.python.org/downloads/macos/, I wanted to see if I could start using Python again in a Jupyter notebook in VS Code. When I try to run a simple print('hello world') in a python chunk I (unsurprisingly) get the following error:
Jupyter cannot be started. Error attempting to locate jupyter: Running cells with 'Python 3.9.10 64-bit' requires notebook package.
Run the following command to install 'jupyter and notebook' into the Python environment.
Command: 'python -m pip install jupyter notebook -U'
I was pretty much expecting this error, since I knew I had deleted all packages when deleting Anaconda and Python.
However, when I try running python -m pip install jupyter notebook -U in the terminal I ultimately get the following error:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> psutil
note: This is an issue with the package mentioned above, not pip.
Any help or insight is greatly appreciated! I am on MacOS (M1) if that is useful information.
The problem seems to be with the python3 distribution that comes with MacOSX Command Line Tools. Well, at least that same error was gone after following these steps.
So, to fix the problem I installed python3.9 (I presume you can change 3.9 to your desired version, e.g. 3.8 or 3.10) using Homebrew.
Install Homebrew (to check if it's installed already just type brew --version in the terminal):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install python3.9
brew install python#3.9
Create your virtual environment
python3.9 -m venv myvenv
Activate the virtual environment with source myvenv/bin/activate
Finally, install Jupyter using
(myvenv) pip install jupyter notebook
I have the same problem when installing the Jupyter notebook on MacOS 12.5 M2 chip. It turns out that the error is caused by not having GCC on my mac to run the wheel for installing the psutil package because for some reason I removed my XCode from my Mac. So I installed XCode from AppStore and opened XCode after the installation to agree to its terms and conditions. After Xcode went through the setup process I tried pip install jupyter again and it worked well.
In my case, I just opened the XCode, accept the terms and the installation proposed, and tried to install the jupyter again and it worked!
It seems to be very particular about the version of python installed. I set up a fresh installation on a new box this morning and put 3.11 on there. pip install jupyterlabs gave me the same error as you got. I then uninstalled python and installed an earlier version, and now it works.
PS the older version that worked for me is 3.10.8

What’s the difference between python and python3

I’m following some instructions to configure my pc to coding some solidity sample projects and the instructions tell me to install pip and pipx, but first I need to check the version of Python installed. The instructions say to run this at the command prompt:
python3 --version
but when I do, I get the following error:
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
However, if I run:
Python --version
It returns: Python 3.8.5
So when I’m instructed to run “python3” …. Is that an apple syntax where I would use just “python” for windows? I’ve googled this and could not find any clarification.
Thank you.
Often in reading instructions for installing things in Python, we see syntax like this:
python3 --version
but on my PC I get an error "Cannot find python3" even though I have python 3.7, 3.8 and 3.9 installed.
For me using this syntax worked:
python --version
python -m pip install --user pipx
python -m pipx ensurepath

Spyder Kernels "module not found" on Ubuntu VM

I am trying to connect a spyder kernel with my remote Ubuntu machine and was following this guide. Installing spyder kernels using sudo pip install spyder-kernels worked fine.
However, when trying to run:
python -m spyder_kernels.console — matplotlib=’inline’ — ip=my.vm.ip.address. -f=./remotemachine.json
I receive the following error on my VM:
Error while finding module specification for 'spyder_kernels.console' (ModuleNotFoundError: No module named 'spyder_kernels')
My remote VM uses Python 3.7.7 and is hosted by Google's cloud platform.
Any help much appreciated.
The issue is that running sudo pip install, you're using the root user's Python installation, and not the user installation you eventually run your command from.
Try using either python -m pip install spyder-kernels or sudo python -m spyder_kernels.console .... Preferably you would not run either command as root.

Pip install installs libraries into different locations

I have just started using python and I have set up python3 to be installed in C:\Python37 dir. I have added python3 path to environment variables. When I run python3 -m pip install [package_name] it installs it in C:\Python37\Lib\site-packages. But when I try to install pylint with python3 -m pip install pylint it prints:
Requirement already satisfied: pylint in c:\users\radio\appdata\roaming\python\python37\site-packages (2.3.1)
It's installing it in above mentioned completely different location, and then VS Code complains how pylint is not installed. Why doesn't pip install it in C:\Python37\Lib\site-packages where it installs all the other packages?
It seems you might have multiple python installations on the computer or you are not running CMD with administrator priviledges when using pip.
I would refer you to this thread: windows pip installing libraries in wrong directory which seems to deal with a problem similar to the one you are having.
I would also try checking the environment variables to see the path set for Python if that doesn't work.

sphinx-quickstart ImportError no module named sphinx.quickstart

I am trying to run python sphinx on a CentOS-7 VM, using a virtual python 3.6.1 environment.
Steps:
Create python3 virtual environment
$ pyvenv myapp
$ source myapp/bin/activate
Install required packages for myproj
$ pip install -r requirements.txt
Install sphinx
$ pip install sphinx sphinx-autobuild
Try and run the quickstart:
$ sphinx-quickstart
File "/bin/sphinx-quickstart", line 7 in <module>
from sphinx.quickstart import main
ImportError: No module named sphinx.quickstart
pip freeze indicates that I am running the following versions:
Sphinx==1.6.3
sphinx-autobuild==0.7.1
pyvenv has been deprecated. See note in the Python library docs:
Note: The pyvenv script has been deprecated as of Python 3.6 in favor of using python3 -m venv to help prevent any potential confusion as to which Python interpreter a virtual environment will be based on.
Instead first make sure you have not already activated a virtual environment. Then issue the command:
python3 -m venv myapp
The rest of your steps look OK.
I solved the problem. I am new to python and pyvenv, and apparently it was finding a "universally" installed version of sphinx outside of the virtual environment, and that was preempting the version that was installed inside the virtualenv. I solved the problem by specifying the full path:
/full-path-to-myapp/myapp/bin/sphinx-quickstart

Resources