After pip3 installing nbconvert and jupyter and installing MacTex, I still have the following error, which wouldnt allow me to export to PDF:
Could anyone provide assistance? Thank you
You can export it to HTML and then using the Print to PDF feature of your browser like the message suggested.
If you insist to export it to PDF directly. After you install the MacTex you need to restart your computer, and make sure the installation path of MacTex can be found in your VSCode terminal, xelatex command can be recognized. Like this picture displays(Windows):
Related
I'm trying to follow the fine tuning guide for Openai here.
I ran:
pip install --upgrade openai
Which install without any errors.
But even after restarting my terminal, i still get
zsh: command not found: openai
Here is the output of echo $PATH:
/bin:/usr/bin:/usr/local/bin:/Users/nickrose/Downloads/google-cloud-sdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Here is the output of which python:
/usr/bin/python
Any tips for how to fix this? I'm on MacOS Big Sur 11.6.
Basically pip installs the packages under its related python directory, in a directory called site-packages (most likely, I'm not a python expert tbh). This is not included in the path you provided. First, ask pip to show the location to the package:
pip show openai
The output would be something like this:
Name: openai
Version: 0.22.0
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: /Users/<USER>/DIR/TO/SOME/PYTHON/site-packages
Requires: numpy, openpyxl, pandas, pandas-stubs, requests, tqdm
Required-by:
So your package will be available in
/Users/<USER>/DIR/TO/SOME/PYTHON/site-packages/openai
Either add /Users/<USER>/DIR/TO/SOME/PYTHON/site-packages/ to your path, or use the complete address to your package, or try to access it using your python:
python -m openai # -m stands for module
To get more information about the -m flag, run python --help.
Update
So as you mentioned in the comments, you get permission denied after you add the directory to your package. This actually means that the package exists, but it's not permitted by your OS to execute. This is the thing you have to do, locate your package, and then:
sudo chmod +x /PATH/TO/script
And the reason you're getting command not found after you use sudo directly with the package, is that you update your path variable in zsh, but when you use sudo, superuser uses sh instead of zsh.
This doesn't answer the question directly but specifies an alternative if you only want to prepare the data set and create the new model for finetunning. It doesn't matter which system you have.
After a lot of struggle I decided it was not worth the hassel to run the cli on my specific machine because of so many different configurations and the mess. My end goal was just to create a model and upload it to OpenAI.
So if someone else stumbles on this post, just use Google Colab. I have also shared one of mine with steps to follow in here.
In case the links don't work in the future I'll list the steps here below as well:
(Step 1)
Set your API key (The already added api key is fake so please replace it with your own):
%env OPENAI_API_KEY=sk-Kz8Weh1234ddgYBmsdfinsdf7ndsfg55532432
(Step 2)
Install the openai package with pip like the following:
!pip install -Uq openai
(Step 3)
Import the openai package like the following:
import openai
(Step 4)
Make sure to upload the promptdata.csv file in the Google Colab folders.
The way to do it is:
On the right side you'll see a Hamburger Menu icon click on it.
You'll see the "Table of Contents"
Click on the last folder icon on the top. If you hover on the icon it says "Files".
Now you'll see a folder called "sample_data".
Click on the three dots menu for "sample_data" and then select "upload".
You should be able to upload your csv file
It is not mandatory to upload a csv file. You can also upload any type of TSV, XLSX, JSON or JSONL file as listed by the OpenAI documentation here. But it will always be converted to JSONL file after runnning the below command.
Once you're done uploading the file you can run the below command to prepare your data set which will return you a new JSONL file at the same location where the original file was with all the corrections the tool provides.
!openai tools fine_tunes.prepare_data -f "/content/sample_data/promptdata.csv"
(Step 5)
Run the below command once again after the corrections and it will most likely say "No remediations found".
!openai tools fine_tunes.prepare_data -f "/content/sample_data/promptdata_prepared.jsonl"
(Step 6)
Finally run the below command using the file promptdata_prepared.jsonl and create a model.
!openai api fine_tunes.create -t "/content/sample_data/promptdata_prepared.jsonl"
(Step 7)
Once the model is created note the name of the "Uploaded model"
So what happens is that after installing the package there are no actual executables available. That's why you get the error message when you try to execute for example:
openai --help
What i managed to find is that the actual parsing of the commands is done in
/Users/<USER>/DIR_TO_PYTHON/site-packages/openai/_openai_scripts.py
That's just a python script which by default is not executable, so you have to make a workaround of which I find the easiest is creating an executable which basically calls it with the given arguments. Below are the steps which I've done to make it work on "macOS Monterey 12.0.1"
Locate the "openai" package which should be in
/Users/<USER>/DIR_TO_PYTHON/site-packages/
Make sure you are in the "openai" package folder and run
sudo vim /bin/openai
That should create a new file, put in the following command and make sure the path to the file is correct
python3 /Users/<USER>/DIR_TO_PYTHON/site-packages/openai/_openai_scripts.py $#
$# is for the params that you pass when you call the executable
After saving the file the next step is making it executable which is done with
chmod +x /bin/openai
Last step is adding it to the PATH which is done by adding the file path in /etc/paths and after restarting the terminal, you should have fully working openai command globally
I was facing similar issue. It might due to global python in your machine is not maching with the pip installation path and it might be installing in some other python folder like in 3.9 and you have 3.10 python version globally set in your Mac.
First install fresh python using homebrew
brew install python
It will install the latest python into your machine. Then try to install openai again using
pip3 install openai
OR using pip (you can try installing using both and see which works as per your system config)
pip install openai
Now
ENJOY a cup of coffee ;)
I'm trying to run QT Designer from the terminal
pyside6-designer
but get the error message:
venv/lib/python3.8/site-packages/PySide6/designer: error while loading shared libraries: libQt6DesignerComponents.so.6: cannot open shared object file: No such file or directory
Inspecting the folder, I can confirm libQt6DesignerComponents.so.6 exist in the folder:
/venv/lib/python3.8/site-packages/PySide6/Qt/lib
I have re-installed and also tried the alternative PIPENV, but same result. Trying to execute in the same folder it ask me to install qtchooser. But didn't work after installing this.
I am on Ubuntu 20.04. I can find a ticket saying it should be solved. link to solution
I have also tried some random stuff, such as
sudo /sbin/ldconfig -v
which is described here its foss. It didn't work.
Anyone got experience of the same problem and have a solution?
Set your LD_LIBRARY path in shell (bash) after activating a venv:
export LD_LIBRARY_PATH=/home/FILL_IN_USERNAME/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/PySide6/Qt/lib/
I'm running Kubuntu Groovy Gorilla.
I'm quite excited about trying this out.
I have just installed atom and am trying to run some python code. I have manually selected that I am using python in the bottom right corner to be sure and yet there is still zero text highlighting. The text highlighting is working in other languages(I tried HTML and it worked perfectly). The file is saved with a .py extension. I am very new to coding so feel free to assume I'm missing something Blatant. Atom-ide-ui and ide-python are installed. Here's a screenshot of editor as I see it.
I recommend installing the ide-python package in Atom. You can run this from the command line:
apm install atom-ide-ui
apm install ide-python
Or install ide-python and atom-ide-ui from Install in Atom's settings.
So I have been having issues with getting PyCharm to find my python3 interpreter on my Mac. I have downloaded a few packages with pip from the terminal and when I use the python shell from the terminal and import them, I get no errors.
When I check where these packages are downloaded, I get this path:
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.>7/lib/python3.7/site-packages
So the issue is when I try to use the PyCharm IDE I don't have access to these packages. I have gone into the settings to change the interpreter and I have tried all these options, none of which show my installed packages.
![1]:https://i.imgur.com/dhTg8CV.png
I have also tried navigating to that path where it shows my packages are downloaded and selecting the python.exe (the highlighted file) I find, but get this error with PyCharm ->
![2]:https://i.imgur.com/DbW5y6I.png
![3]:https://i.imgur.com/B8H4hlA.png
I have a feeling I am selecting the wrong python.exe but I don't know where to look. I also think the problem could stem from me installing iTerm and the zshrc bash program and it changed my paths, but I don't know why python would be working from my terminal then. Just in case, this is what my Path is in my zshrc file:
export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH="$HOME/.composer/vendor/bin:$PATH"
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
Sorry for the long post and no inline images, this is my first post. Any help would be greatly appreciated! Just trying to get this to work so I can work on a project.
Update
just thought it would be useful to know that when i type "which python3" in the terminal it returns -> /usr/local/bin/python3
The simple solution is
Open the pycharm
Go to top left most side on IDE and open FILE dropdown.
Open the project which contains PIP files.
By this procedure pycharm automatic detect the virtual environment.
I am trying to get the ipynb running on my Mac, but I am running into some trouble. I specifically want to run the ipynb that comes with Anaconda.
This question is very close to helping me but I am not sure what to do with the results from checking which python, which python2.7, which ipython.
When I type 'ipython' into the terminal, I get
/bin/bash: /Users/me/anaconda/bin/python.app: No such file or directory
Anaconda isn't even located in /Users/me/ so I don't know why bash is looking there when I've put /usr/local/bin/anaconda/bin at the front of my path (which I did after that post suggested I check my path variable).
$ which anaconda
/usr/local/bin/anaconda/bin/anaconda
$ which python
/usr/local/bin/anaconda/bin/python`
$ which python2.7
/usr/local/bin/anaconda/bin/python2.7
$ which ipython
/usr/local/bin/anaconda/bin/ipython
I tried this to see if it worked, because I'm guessing it is related to the problem I am having:
$ conda -h
-bash: /usr/local/bin/anaconda/bin/conda: /Users/me/anaconda/bin/python: bad interpreter: No such file or directory`
From the responses I'm getting from bash, it looks like everything is pointing to where it should be, so then why, when I type ipython or conda into the terminal, do I get those errors?
(Not sure if this is related, but some posts I've seen refer to changing the pip file to point to the version of Python I want, but I am not quite sure where to find the 'pip file'. I went looking for it wherever my pip is stored but I couldn't find a file per say.)
It is most likely looking in the wrong place. Standard installations would be in /Users/username/anaconda/bin. If you have installed it in /usr/local/bin/anaconda/bin/python you will want to be sure it is in you .bash_profile. In terminal run the following:
open .bash_proflie
Add the following:
export PATH="/usr/local/bin/anaconda/bin:$PATH"
Again the usual Path would be:
export PATH="/Users/me/anaconda/bin:$PATH"
Be sure to relaunch terminal or run "source .bash_profile"
I solved this problem by moving anaconda to root ("/")