Sorry it's hard to be specific here but I'm struggling to pin down the source of various error messages in my Linux shell with asdf.
I've got Fish shell 3.4.0 running on a RHEL 8.5 GNU/Linux system, and have installed and used asdf with it for several months with no problems. I've used asdf to install and use Python and R virtual environments with direnv as well.
However, starting yesterday, when I open my Gnome Terminal application to start the Fish shell, I get this error:
environment:987: use_asdf: command not found
I can still use the shell, but I noticed the the pipx tool I installed via my asdf-managed Python can no longer be found.
Also, if I start a Bash shell instead, I'm presented with this error:
bash: register-python-argcomplete: command not found... Install package 'python3-argcomplete' to provide command 'register-python-argcomplete'? [N/y]
If I choose N ("no"), I can still get to the bash shell.
The problem is, I have no idea where these errors are coming from or how to find the root of the problem. How can I begin to troubleshoot these errors?
Thank you.
UPDATE:
asdf and its plugins are all fully updated.
There's the output from asdf info:
OS:
Linux [hostname] 4.18.0-348.20.1.el8_5.x86_64 #1 SMP Tue Mar 8 12:56:54 EST 2022 x86_64 x86_64 x86_64 GNU/Linux
SHELL:
fish, version 3.4.1
ASDF VERSION:
v0.10.0-77fd510
ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/home/[username]/.asdf
ASDF INSTALLED PLUGINS:
direnv https://github.com/asdf-community/asdf-direnv.git master 7dcd571
nodejs https://github.com/asdf-vm/asdf-nodejs.git master f9957f3
python https://github.com/danhper/asdf-python.git master 57a4d72
R https://github.com/asdf-community/asdf-r.git master 3eab1a6
I do not recognize the environment:987: use_asdf: command not found error or the register-python-argcomplete: command not found error.
I'd suggest upgrading to the latest version of asdf and the latest version of all the asdf plugins you are using. If you still have issues please update you r question with the output from asdf info so we can get a better understanding of what your environment is like.
Related
I downloaded Python 3.9.7 universal2 installer and installed Python on my M1-chip MacBook. Note that this was the first Python installation on this machine except for Apple-provided Python 2.7.16.
Then after running python3 --version line in the Terminal I've got this output xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools. and a pop-up window was opened suggesting installing necessary software. I installed it.
After that I ran python3 --version line again and got this output: Python 3.8.2. The expected output is Python 3.9.7.
What happened? Did I do anything wrong? How to fix it?
It turns out that at least for M1 Macs Apple provides two versions of Python: 2.7.16 and 3.8.2 by default. The commands python --version and python3 --version correspond to them as they appear. The command needed to be used is python3.9 --version which outputs Python 3.9.7 as expected.
I'm using macOS Mojave 10.14.2, and pyenv 1.2.7 .
And these are my configs of pyenv.
python2 seems to work in the terminal.
$ pyenv versions
system
* 2.7.14
3.6.4
$ pyenv global
2.7.14
3.6.4
$ pyenv local
2.7.14
$ python2
Python 2.7.14 (default, Sep 12 2018, 16:35:37)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> (It works!)
But when I use gcloud command, it fails saying it cannot find python2.
$ gcloud config list
pyenv: python2: command not found
The `python2' command exists in these Python versions:
2.7.14
On the other hand, npm command, which requires python2 too, works fine.
It get fixed by pyenv shell command temporarily, but it is valid only until I close the terminal.
(The solution is referred here: https://github.com/pyenv/pyenv/issues/1159)
$ pyenv shell 2.7.14 3.6.4
$ gcloud config list -> Works!
How to fix this problem permanently ?
I was recently encountering this error and found a solution. I am using pyenv with virtual env (pyenv-viritualenv) and I was attempting to run gcloud from inside my python 3 virtual environment.
The issue is that when you run gcloud from a location within the virtualenv, it only knows of the python versions specified in the .python-version file for that directory. You therefore have to specify a python 2 version to run in addition to your python 3 version:
pyenv local <virtualenv name> <python 2 version>
I did this in addition to doing the CLOUDSDK_PYTHON bit mentioned in answers on other related questions:
export CLOUDSDK_PYTHON=$(which python2)
I added this to my .bash_profile
if when you type python on the terminal, it shows different python versions. for example you want to point out to 3.9.0 version. you can type pyenv global 3.9.0
I'm seeing something very odd, and honestly I'm stumped.
The version of vim that comes with mac is outdated (7.3 instead of 7.4). I'm trying to install vim from homebrew, and I want to use that one instead of the default apple version.
I ran "brew install vim". It installed correctly in /usr/local/bin/vim. All good.
When I run "which vim", it prints "/usr/local/bin/vim". The Apple version of vim is installed at /usr/bin/vim. So the which command is telling me that I'm using the homebrew version of vim.
However, when I actually run vim, it still runs the Apple version
$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul 9 2015 23:58:42)
Compiled by root#apple.com
...
If I run the homebrew version explicitly, I see this:
$ /usr/local/bin/vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Oct 23 2015 18:16:35)
MacOS X (unix) version
Included patches: 1-898
Compiled by Homebrew
...
I even tried moving /usr/bin/vim to /usr/bin/vim73 to try to force using the homebrew version. However, when I did this, here is what I see when I try to run vim:
$ vim --version
-bash: /usr/bin/vim: No such file or directory
$
What is going on? How can I get it to run the homebrew version of vim?
Start a new shell session and it’ll work.
Bash caches executables’ paths so when you run vim it looks at your PATH to find the first executable with this name. It caches it and the second time you run vim it remembers vim is actually /usr/bin/vim and runs that.
Since you haven’t restarted your Bash session its cache is still the same; hence the error you’re seeing. It has nothing to do with the way you installed vim.
If you don’t want to start a new shell session, you can run hash -r to tell Bash to clear its executables memory.
You forgot an argument:
$ brew install vim --override-system-vi
I would like to use rbenv to control my ruby environment. I followed the basic gethub checkout installation instructions in this site: https://github.com/sstephenson/rbenv#understanding-path
However when i use rbenv command, it says that it isnt found!! When I type
source ~/.bash_profile
(where rbenv path is indicated), into the command line, it says
export: Command not found!!
What a i suppose to do at this point? I need rbenv to install gems because I dont have permission to install (even if i use sudo i need permission). I followed the installation instructions correctly, what is the source of the problem?
info about OS:
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseWorkstation
Description: Red Hat Enterprise Linux Workstation release 6.5 (Santiago)
Release: 6.5
Codename: Santiago
Most of the instructions for installing rbenv are valid for bash and similar POSIX compliant shells. C Shell is not POSIX compliant. This means, among other things, that some commands will not be present or have different names.
So some things to take note of:
You may want to use a file called .cshrc instead of .bash_profile or .bashrc.
The equivalent of export in csh is set or setenv, depending on what kind of behavior you're looking for: http://www.cyberciti.biz/faq/unix-linux-difference-between-set-and-setenv-c-shell-variable/
You may need to run rehash after changing ruby versions: http://blog.hplogsdon.com/multiple-ruby-versions-a-battle-between-rbenv-and-rvm-csh-edition/
To minimize confusion, I'd recommend checking if you can change your default shell to something like bash or zsh.
I need to run Python 2.7 on my Mac Snow Leopard, which has Python 2.6 installed. According to this answer, running the Python 2.7 mpkg installer from Python.org should get me there.
The reason I need to do this is that I'm trying to run the Google App Engine SDK for the Python 2.7 runtime.
After installing Python 2.7, I'm still getting the following warning in my GAE server log:
Warning: You are using a Python runtime (2.6) that is older than the
production runtime environment (2.7).
What else must I do to get the GAE SDK to recognize the new Python version?
EDIT 2:
Running:
$ sudo find / -name python2.7
I get:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/usr/local/bin/python2.7
According to the answers I went into GoogleAppLauncher -> Preferences and set the Python path to each of these, and each time I get the exact same error.
Running dev_appserver with the following flags:
--admin_console_server= --port=8081 Python command: /Library/Frameworks/Python.framework/Versions/2.7 2011-11-14
16:12:24.726 GoogleAppEngineLauncher[57590:203] *** NSTask: Task
create for path '/Library/Frameworks/Python.framework/Versions/2.7'
failed: 22, "Invalid argument". Terminating temporary process.
Another Wierd thing is, it always tries to resolve to the same path, no matter which of those I plug in; It always reverts to /Library/Frameworks/Python.framework/Versions/2.7
EDIT 3:
OK, after entering the paths into the prefs field repeatedly, I finally just cleared it out, and somehow it's now pointing to the right place:
Running dev_appserver with the following flags:
--admin_console_server= --port=8081
Python command: /usr/local/bin/python2.7
Open the GAE launcher preferences and set the Python Path option to the fresh installed Python 2.7, in your case /usr/local/bin/python2.7 .
Came across this question looking for a solution to the same dilemma regarding Mac, GAE and Python.
One comment I would like to make regarding setting the Python path using GAE Preferences. I notice you mention that you had a problem setting the Python path using the Preferences. I discovered that after editing the path, you have to press Enter. Otherwise, the path doesn't get updated. This might explain the weirdness you were mentioning when trying to edit the path field.
I installed python 2.7.x from macports. I see this:
$ python --version
Python 2.7.2
$ which python
/opt/local/bin/python
So, in the preferences for GoogleAppEngineLauncher.app I set the python path to:
/opt/local/bin/python
In the console log, I see this:
*** Running dev_appserver with the following flags:
--admin_console_server= --port=8081
Python command: /opt/local/bin/python
I still see some errors about libraries, in particular Can't open zipfile...setuptools but simple stuff at least seems to work.
Good luck!
I am not sure if it helps, but instead of using the binaries from Python, I used MacPorts http://www.macports.org/ and installed the Python 2.7 runtime:
sudo port install python27