I attempted to follow the instructions from this link https://prishitakapoor2.medium.com/configuring-git-bash-to-run-python-for-windows-a624aa4ae2c5 to setup python with git bash. However when I attempt to run source .bashrc I receive the following error
bash: export: python.exe export PATH=/mingw64/bin:/usr/bin:/c/Users/Grant/bin:/c/Program Files/Oculus/Support/oculus-runtime:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/Program Files (x86)/Common Files/Intel/Shared Libraries/redist/intel64/compiler:/c/ProgramData/Oracle/Java/javapath:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/AMD/ATI.ACE/Core-Static:/c/Program Files (x86)/Calibre2:/c/Program Files (x86)/QuickTime/QTSystem:/c/WINDOWS/System32/OpenSSH:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files/dotnet:/c/Program Files (x86)/Microsoft SQL Server/150/DTS/Binn:/c/Program Files/Azure Data Studio/bin:/cmd:/c/Udacity/Python:/c/Udacity/Python/Library/mingw-w64/bin:/c/Udacity/Python/Library/usr/bin:/c/Udacity/Python/Library/bin:/c/Udacity/Python/Scripts:/c/Users/Grant/AppData/Local/Microsoft/WindowsApps:/c/Program Files/Azure Data Studio/bin:/c/Users/Grant/AppData/Local/atom/bin:/c/Users/Grant/Anaconda3:/c/Users/Grant/Anaconda3/scripts alias python=winpty:/c/users/grant/anaconda3:/c/users/grant/anaconda3/Scripts:\C\Users\Grant\anaconda3:\C\Users\Grant\anaconda3/Scripts:\C\Users\Grant\Desktop\anaconda3:\C\Users\Grant\Desktop\anaconda3\Scripts:/c/Users/Grant/Anaconda3:/c/Users/Grant/Anaconda3/scripts': not a valid identifier bash: .bashrc: line 13: unexpected EOF while looking for matching "'
I have attempted to uninstall both batch and anaconda and reinstall both to fix the issue but I am unable to resolve the problem. Any tips? I am very new to this and trying to get python setup on my local PC for the first time.
I attempted to update the path by using the echo 'export PATH="$PATH:[YOUR_PATH]:[YOUR_PATH]/Scripts"' >> .bashrc again but this did not allow me to change the path and I am still receiving the same error.
As error tells, you have unmatched " in your .bashrc file. To more accurate answer,will be good if you attach .bashrc file
Related
when executing a python script, I get this after generating a figure:
libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri) libGL error: failed to load driver: iris libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri) libGL error: failed to load driver: iris libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri) libGL error: failed to load driver: swrast
I dont know how to fix it, i have searched for information but have found nothing to help me
Here are two possible solutions. Try them both and see what works.
Solution 1
Follow the instructions in this answer.
Solution 2
If you are using Anaconda to run this Python script, Anaconda may be the reason. This solution was taken from here (update 3), which in turn was taken from here.
From the latter link:
According to online information, there is a problem with the libstdc++.so file in Anaconda (I use this commercial python distribution). It cannot be associated with the driver of the system, so we removed it and used the libstdc++ that comes with Linux. so creates a soft link there.
To solve this problem, run this in bash:
$ cd /home/$USER/miniconda/lib
$ mkdir backup # Create a new folder to keep the original libstdc++
$ mv libstd* backup # Put all libstdc++ files into the folder, including soft links
$ cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./ # Copy the c++ dynamic link library of the system here
$ ln -s libstdc++.so.6 libstdc++.so
$ ln -s libstdc++.so.6 libstdc++.so.6.0.19
where $USER should be your own username.
This worked for me:
mv ~/anaconda3/lib/libstdc++.so.6 ~/libstdc++.so.6
i resolved this issue with spyder 5.3.3 python 3.10.9 using this answer
https://stackoverflow.com/a/71421355/9153119
conda install -c conda-forge libstdcxx-ng
I downloaded this code from github and it runs fine on my local computer, but I need to use in google colab, where it throws errors. More precisely, what I get as error output is:
/bin/sh: 1: ./rbox: Permission denied
/bin/sh: 1: ./qhull: Permission denied
...
ModuleNotFoundError: No module named 'python_tools.fastmodules'
The full error message can be seen here as well as in the notebook here. I tried different suggestions for giving permission for executing the files ./rbox and ./qhull - I inserted a new cell before the code snippet containing
!chmod 755 -R /content/gdrive/MyDrive/PhD/revolver/qhull/src/ #pointing to the file-directory
or
!chmod 755 ./rbox
or
!chmod +x /content/gdrive/MyDrive/PhD/revolver/qhull/src/rbox
but none of them solves the error. How can I resolve the error message? It would be also great if someone can download the github code from the link into google drive confirm that he can run it without errors. Installations instructions are provided on the github page, you can use my params.py file and within it you can set tracer_file to point at this file that I used, or any dummy csv-file with 3 columns. Tnx! Your contribution would help me run an astrophysics simulation for my PhD
I made a mistake by confusing the location of my files. There were different copies of the rbox and qhull files in different folders, so I should have done
!chmod +x /content/gdrive/MyDrive/PhD/revolver/qhull/rbox
!chmod +x /content/gdrive/MyDrive/PhD/revolver/qhull/qhull
instead of
!chmod +x /content/gdrive/MyDrive/PhD/revolver/qhull/src/rbox
!chmod +x /content/gdrive/MyDrive/PhD/revolver/qhull/src/qhull
I am following this tutorial to Installing OpenCv on my Raspberry Pi.
However, when I get to the stage to install the virtual environment the following commands execute without issue:
cd $cwd
python3 -m venv OpenCV-"$cvVersion"-py3
echo "# Virtual Environment Wrapper" >> ~/.bashrc
echo "alias workoncv-$cvVersion=\"source $cwd/OpenCV-$cvVersion-py3/bin/activate\"" >> ~/.bashrc
However, the last command on that list source "$cwd"/OpenCV-"$cvVersion"-py3/bin/activate throws an error bash: /OpenCV-master-py3/bin/activate: No such file or directory
I've tried using sudo before the command along with repeating the entire process with sudo-s. When I check the file path the full file is located there with instructions at the top
#This file must be used with "source bin/activate" from bash
#you cannot run it directly
I've tried skipping that step and moving onto the next one but then I get another error: sed: can't read /etc/dphy: No such file or directory - but that's a whole different question.
How can I get the terminal to find the file that I can?
Trying to install Spark and associated programs on Mac but receiving error messages when testing installation.
/Users/somedirectory/apachespark/spark-2.3.0-bin-hadoop2.7/bin/pyspark
/Users/somedirectory/apachespark/spark-2.3.0-bin-hadoop2.7/bin/spark-class: line 71: /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home//bin/java: No such file or directory
from my bash_profile entry...
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/
export SPARK_HOME=/Users/directory/apachespark/spark-2.3.0-bin-hadoop2.7
export SBT_HOME=/Users/directory/apachespark/sbt
export SCALA_HOME=/Users/directory/apachespark/scala-2.11.12
export PATH=$JAVA_HOME/bin:$SBT_HOME/bin:$SBT_HOME/lib:$SCALA_HOME/bin:$SCALA_HOME/lib:$PATH
export PATH=$JAVA_HOME/bin:$SPARK_HOME:$SPARK_HOME/bin:$SPARK_HOME/sbin:$PATH
export PYSPARK_PYTHON=python3
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
correction suggestions? Thanks.
As shown in the reported error message:
/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home//bin/java: No such file or directory
your file path for the Java executable $JAVA_HOME/bin generates an extra / due to the trailing / in your JAVA_HOME:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/
Removing the trailing / in JAVA_HOME should fix the problem. Better yet, setting JAVA_HOME as shown below would automatically point to the active JDK version on Mac OSX:
export JAVA_HOME=$(/usr/libexec/java_home)
I trying to setup virtualenvwrapper in GitBash (Windows 7). I write the next lines:
1 $ export WORKON_HOME=$HOME/.virtualenvs
2 $ export MSYS_HOME=/c/msys/1.0
3 $ source /usr/local/bin/virtualenvwrapper.sh
And the last line give me an error:
source /usr/local/bin/virtualenvwrapper.sh
sh.exe: /usr/local/bin/virtualenvwrapper.sh: No such file or directory
I find, where on my drive is virtualenvwrapper.sh and change directory name. On my computer it's /c/Python27/Scripts/virtualenvwrapper.sh. When I again run command
$source /c/Python27/Scripts/virtualenvwrapper.sh
I get the next ERROR message:
sh.exe":mktemp:command not found ERROR: virtualenvwrapper could not create a temporary file name
I check my enviroment variable: C:\python27\;C:\python27\scripts\;C:\python27\scripts\virtualenvwrapper.sh\;C:\msys;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Git\bin\
I don't know where i made a mistake
The error is saying that sh.exe (the shell) can't find a command matching mktemp, which means it's not present in GitBash, at least not in your environment.
One option is you could download a Windows version of mktemp, such as http://gnuwin32.sourceforge.net/packages/mktemp.htm and then place it in the C:\Program Files (x86)\Git\bin directory. The shell should then be able to match the mktemp command and be able to proceed.
I've found a fix for this problem on a Windows 8 machine using GitBash.
TL;DR:
Get mktemp for windows, put it somewhere that can be used by GitBash, then edit virtualenvwrapper.sh and on line 202, add a touch command with the file created. It should look like this:
file="$(virtualenvwrapper_mktemp -t virtualenvwrapper-$suffix-XXXXXXXXXX)"
touch $file # this is the new line
if [ $? -ne 0 ] || [ -z "$file" ] || [ ! -f "$file" ]
FULL ANSWER:
As khampson mentioned, you do have to download mktemp and place it where your Git\bin (C:\Program Files (x86)\Git\bin usually) directory is. After that, running the virtualenvwrapper.sh file would cause an error saying:
path = C:/Users/User/AppData/Local/Temp/virtualenvwrapper-initialize-hook-XXXXXX XXXX
lpPathBuffer = C:\Users\User\AppData\Local\Temp\
szTempName = C:\Users\User\AppData\Local\Temp\tmp23A9.tmp
path = C:\Users\User\AppData\Local\Temp\tmp23A9.tmp
fd = 3
ERROR: virtualenvwrapper could not create a temporary file name.
On line 202(source), you see a function call to virtualenvwrapper_mktemp (which is just a wrapper function to call mktemp) and this is supposed to create the new temp file, but apparently it doesn't on windows.
Going through the manual for mktemp, on the examples section, you see that they are always sending something to that new file handle which forces the file to be created.
So instead of sending an empty string using echo like the manual, just add a touch command to the virtualenvwrapper.sh:
file="$(virtualenvwrapper_mktemp -t virtualenvwrapper-$suffix-XXXXXXXXXX)"
touch $file # new command here
This should force windows to create the temp file. I can't post the rest of the links due to low rep but I hope this still helps someone.
EDIT
I created a pull request on the virtualenvwrapper repo and it got approved. You can see the touch command I suggested added here.