I was trying to install openai to fine tune the model and use opeanAI cli to train the model.
python --version
Python 3.10.6
I also installed openai package
pip show openai
Name: openai
Version: 0.26.4
Summary: Python client library for the OpenAI API
Home-page: https://github.com/openai/openai-python
Author: OpenAI
Author-email: support#openai.com
License:
Location: /home/vanshmittal/.local/lib/python3.10/site-packages
Requires: aiohttp, requests, tqdm
Required-by:
.zshrc file contains
alias python=/usr/bin/python3
alias pip=/usr/bin/pip3.10
export PATH="$PATH:/home/vanshmittal/.local/lib/python3.10/site-packages/openai"
On checking $PATH
echo $PATH
it had the above path provided
:/home/vanshmittal/.local/lib/python3.10/site-packages/openai
on running opeanAI CLI command says zsh: command not found: openai
openai tools fine_tunes.prepare_data -f <file_path>
I also followed this stackoverflow question:- openai command not found (mac)
python -m openai
/usr/bin/python3: No module named openai.__main__; 'openai' is a package and cannot be directly executed
Made the file executable also
sudo chmod +x /home/vanshmittal/.local/lib/python3.10/site-packages/openai/
But even after that also it's returning zsh: command not found: openai
Could anyone please help me, what additionally needs to be done for successfull installation?
Related
I am trying to install the Google Analytics apps in Django and when trying:
django-google-analytics-app --version
django-google-analytics-app -V
which django-google-analytics-app
I either get
zsh: command not found: django-google-analytics-app
or
django-google-analytics-app not found
How could I check if this app has been installed and how could I check its version?
django-google-analytics-app will not give you a binary file to get the version against. You can run the following command to see if the package is installed.
pip freeze | grep "django-google-analytics-app"
If this command gives you some output similar to
django-google-analytics-app==<version>
then the package is installed. If there is no output then the package is not installed
I'm on a Mac OSX (Catalina) trying to install the AWS Elastic Beanstalk CLI.
>>>python --version
Python 2.7.16
>>>which python
/usr/bin/python
>>>python3 --version
Python 3.7.5
>>>which python3
/usr/local/bin/python3
What I've tried
Using Brew
>>>brew uninstall awsebcli
>>>brew install awsebcli
>>>eb --version
-bash: /Users/<user>/.local/bin/eb: /Users/<user>/projects/hello-world-flask/venv/bin/python3: bad interpreter: No such file or directory
Now the funny thing is that hello-world-flask is just a toy example I have in one of my directories, but I have no idea why the EB CLI is trying to use that venv, or why it says that it doesn't exist.
>>>ls /Users/<user>/projects/hello-world-flask/venv/bin/python3
/Users/<user>/projects/hello-world-flask/venv/bin/python3
Using Pip3
>>>brew uninstall awsebcli
>>>pip3 install awsebcli
...
Successfully installed awsebcli-3.16.0
>>>eb --version
-bash: /Users/<user>/.local/bin/eb: /Users/<user>/projects/hello-world-flask/venv/bin/python3: bad interpreter: No such file or directory
The Question
I'm assuming the EB CLI is just supposed to execute Python 3.x. How do I fix this and make the EB CLI use the correct version of Python?
I realize this answer is a bit late and ran into a similar issue myself. According to this you might have better luck being explicit about your python executable and using the --python-installation flag. Try something like
python scripts/ebcli_installer.py --python-installation /path/to/some/python/on/your/computer
or to be extra explicit
/path/to/your/exact/python scripts/ebcli_installer.py --python-installation /path/to/some/python/on/your/computer
This is part of the "Advanced Use" section on the EB CLI github
I couldn't figure this out. I keep encountering error env: python: No such file or directory. So I just defaulted to installing it via brew https://formulae.brew.sh/formula/aws-elasticbeanstalk#default
I ran the command pip install coverage and it appears to have installed correctly.
Frodo:Triangle567 tarikkdiry$ pip install coverage
Collecting coverage
Using cached https://files.pythonhosted.org/packages/c7/d0/337673c08f5b0cc7ada3dfe2a998ae8a97d482722045644be3d79bbcbe05/coverage-4.5.1-cp37-cp37m-macosx_10_13_x86_64.whl
Installing collected packages: coverage
Successfully installed coverage-4.5.1
However, after running coverage on one of my test files, I receive this error:
Frodo:Triangle567 tarikkdiry$ coverage run testtriangle.py
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/coverage", line 7, in <module>
from coverage.cmdline import main
ModuleNotFoundError: No module named 'coverage.cmdline'; 'coverage' is not a package
Frodo:Triangle567 tarikkdiry$
I have tried uninstalling every python package and reinstalling but to no success. I have tried this on another machine and can confirm the test file is working properly.
EDIT: After running pip3 check coverage and pip3 show coverage
pip3 check coverage:
No broken requirements found.
pip3 show coverage
Name: coverage
Version: 4.5.1
Summary: Code coverage measurement for Python
Home-page: https://bitbucket.org/ned/coveragepy
Author: Ned Batchelder and 100 others
Author-email: ned#nedbatchelder.com
License: Apache 2.0
Location: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
Requires:
Required-by:
You should check if coverage refer to python or python3. Most likely it uses python to run exact tool you need. Default python version on macOS is python 2.7.
Another option is to create a virtual environment by running python3.7 -m venv $directory (where $directory contains a folder for virtual environment, you can use direct paths as you wish), then activating it by running source $directory/bin/activate. After doing this, you'll have no problems finding all packages you want. I personally prefer this method over installing packages into the system.
Additionally, you can install python3.7 from MacPorts or Homebrew and activate it as a default python. For many libraries you can install them using these package managers as well.
What worked for me:
python -m coverage run arg1 arg2 arg3
Instead of what is mentioned on https://coverage.readthedocs.io/en/6.0.2/
coverage run arg1 arg2 arg3
Which is similar to this answer for Windows: https://stackoverflow.com/a/36656924/264359
According to the comments, you have a file named coverage.py in your current working directory. This file is interfering with the coverage command's attempts to import from coverage.cmdline. You need to rename the file to something else.
I encountered this on Windows when running pip install coverage when using the mingw64 (bash for Windows) shell. Pip detected a linux environment and didn't include the .exe that Windows needs.
To resolve this I ran pip uninstall coverage then opened an administrative PowerShell prompt and ran pip install coverage.
When I tried creating a virtual environment with python using the command virtualenv venv from Terminal, I got the following error:
Using base prefix '/Users/zacharythomas/anaconda3'
New python executable in /Users/zacharythomas/venv/bin/python
dyld: Library not loaded: #rpath/libpython3.6m.dylib
Referenced from: /Users/zacharythomas/venv/bin/python
Reason: image not found
ERROR: The executable /Users/zacharythomas/venv/bin/python is not functioning
ERROR: It thinks sys.prefix is '/Users/zacharythomas' (should be '/Users/zacharythomas/venv')
ERROR: virtualenv is not compatible with this system or executable
I'm not the first person to encounter a similar error -- I tried following this answer's recommendations and running:
gfind ~/.virtualenvs/my-virtual-env/ -type l -xtype l -delete
That didn't help. Nor did running sudo virtualenv venv to run commmand as a super user.
What should I investigate next?
I had the exact same error message. Ray Donnelly at Continuum Analytics Support Group provided the following solution, which resolved the issue for me:
When you pip installed virtualenvwrapper, pip will have installed
virtualenv for you as it is a dependency. Unfortunately, that
virtualenv is not compatible with Anaconda Python. Fortunately, the
Anaconda Distribution has a virtualenv that is compatible. To fix
this:
pip uninstall virtualenv
conda install virtualenv
can't get virtualenv to work with anaconda3 v4.3 on mac
I tried to install XGBoost package in python.
I am using windows os, 64bits . I have gone through following.
The package directory states that xgboost is unstable for windows and is disabled:
pip installation on windows is currently disabled for further invesigation, please install from github.
https://pypi.python.org/pypi/xgboost/
I am not well versed in Visual Studio, facing problem building XGBoost.
I am missing opportunities to utilize xgboost package in data science.
Please guide, so that I can import the XGBoost package in python.
Thanks
If you are using anaconda (or miniconda) you can use the following:
conda install -c anaconda py-xgboost UPDATED 2019-09-20
Docs
Other channels available, such as rapidsai/py-xgboost UPDATED 2021-12-07
Check install by:
Activating the environment (see below)
Running conda list
To activate an environment:
On Windows, in your Anaconda Prompt, run (assumes your environment is named myenv):
activate myenv
On macOS and Linux, in your Terminal Window, run (assumes your environment is named myenv):
source activate myenv
Conda prepends the path name myenv onto your system command.
Build it from here:
download xgboost whl file from here (make sure to match your python version and system architecture, e.g. "xgboost-0.6-cp35-cp35m-win_amd64.whl" for python 3.5 on 64-bit machine)
open command prompt
cd to your Downloads folder (or wherever you saved the whl file)
pip install xgboost-0.6-cp35-cp35m-win_amd64.whl (or whatever your whl file is named)
You first need to build the library through "make", then you can install using anaconda prompt (if you want it on anaconda) or git bash (if you use it in Python only).
First follow the official guide with the following procedure (in Git Bash on Windows):
git clone --recursive https://github.com/dmlc/xgboost
git submodule init
git submodule update
then install TDM-GCC here and do the following in Git Bash:
alias make='mingw32-make'
cp make/mingw64.mk config.mk; make -j4
Last, do the following using anaconda prompt or Git Bash:
cd xgboost\python-package
python setup.py install
Also refer to these great resources:
Official Guide
Installing Xgboost on Windows
Installing XGBoost For Anaconda on Windows
You can pip install catboost. It is a recently open-sourced gradient boosting library, which is in most cases more accurate and faster than XGBoost, and it has categorical features support.
Here is the site of the library:
https://catboost.ai
pip install xgboost works also with python 3.8, whereas other options mentioned above did not work for me
The following command should work but, If you have a problem with this command
conda install -c conda-forge xgboost
First activate your environment . Assume your environment is named
simply write in conda terminal :
activate <MY_ENV>
and then
pip install xgboost
on a macOS the following command worked
conda install -c conda-forge xgboost but before doing this i had read some other article and hence did install gcc using brew
Besides what's already on developers' github, which is building from source(creating a c++ environment, etc.), I have found an easier way to do it, which I explained here with details. Basically, you have to go a website by UC Irvine and download a .whl file, then cd to the folder and install xgboost with pip.
XGBoost is used in Applied Machine Learning and is known for its gradient boost algorithm and it is available as a library in python but has to be compiled using cmake.
Alternatively what you can do is from this link you can download the C pre-compiled library and install it using the pip install < FILE-NAME.whl> command. Ensure you have downloaded the library which is compatible with your python version.
I experienced this problem while I was using the same in Anaconda(Spyder). Then just restart the kernel and your error will go away.