I encounter a problem on using the matplotlib-cpp in MacOS. Recently I download the matplotlibb-cpp into my macbook and try to run the sample code to see whether it works properly. I compile the sample code using
g++ test.cpp -std=c++17 \
-I /Users/pangkachun/matplotlib-cpp \
-I /Users/pangkachun/miniforge3/include/python3.9 \
-I /Users/pangkachun/miniforge3/lib/python3.9/site-packages/numpy/core/include \
-L /Users/pangkachun/miniforge3/lib \
-lpython3.9 \
-o plot
However, when I tried to execute the output file ./plot, I got an error message from terminal
dyld[47656]: Library not loaded: #rpath/libpython3.9.dylib
Referenced from: /Users/pangkachun/plot
Reason: tried: '/usr/local/lib/libpython3.9.dylib' (no such file), '/usr/lib/libpython3.9.dylib' (no such file)
zsh: abort ./plot
Could someone give me some guidelines on how to solve this problem?
""" Update"""
I use an alternative method to compile ./plot which symlink the miniforge3/lib that containing libpython3.9.dylib to /usr/local/lib. This /usrlocal/lib is created by my own under symlink. Although this works, I hope there is a "normal" method to deal with this issue.
Related
I am trying to use Pidcat for logging. I downloaded the Pidcat.py and pasted it in the following directory:
C:\Python\Scripts
Added this path in the Environment Variables as well. But when I try to log in using the following command:
pidcat -s deviceId
I get the following error:
Unable to create process using '/usr/bin/env -S python -u "C:\Python\Scripts\pidcat.py" -s deviceId'
I used CMD to run a python file getofflinelog.py.
The command is:
python getofflinelog.py -m txt -d camlog -o offline.log
I got a similar error Unable to create process using '/usr/bin/env...., and I solved it by changing the command to:
C:\Users\liutongjun\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe getofflinelog.py -m txt -d camlog -o offline.log
I also found that if I added this path to the environment variables, the first short command would work.
I'm not very clear why it works, I do not install Python in this path and there are only a series of exe programs in this folder. Just for reference.
While using the generate_tfrecord.py, I'm always getting this error of "generate_tfrecord.py: error: unrecognized arguments".
But, I haven't changed anything, and I've used the same command from the custom object detection tutorial, from the TFOD website.
Link: https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html
Tried both on Google Collab and also on local python environment, still same issue.
Anyone has experienced this error before, if so, how did you solve it? Please help. Thanks!
python generate_tfrecord.py -x [PATH_TO_IMAGES_FOLDER]/train -l [PATH_TO_ANNOTATIONS_FOLDER]/label_map.pbtxt -o [PATH_TO_ANNOTATIONS_FOLDER]/train.record
Changes I made:
python generate_tfrecord.py -x C:/Users/prana/Desktop/cnn_system/images/train -l C:/Users/prana/Desktop/cnn_system/annotations/label_map.pbtxt -o C:/Users/prana/Desktop/cnn_system/annotations/train.record
On Collab, I tried this:
!python generate_tfrecord.py -i /content/trainingdemo/images/train -l /content/trainingdemo/annotations/label_map.pbtxt -o /content/trainingdemo/annotations/train.record
All the files have been double checked, they all exist in the right path.
this worked for me, it may work for someone else.
Try not to leave any spaces in the line of code, replace spaces with _
BEFORE:
python generate_tfrecord.py -x D:/Semestre/graduation project/files/TensorFlow/workspace/training/images/train -l D:/Semestre/graduation project/files/TensorFlow/workspace/training/annotations/labelmap.pbtxt -o D:/Semestre/graduation project/files/TensorFlow/workspace/training/annotations/train.record
AFTER:
python generate_tfrecord.py -x D:/Semestre/graduation_project/files/TensorFlow/workspace/training/images/train -l D:/Semestre/graduation_project/files/TensorFlow/workspace/training/annotations/labelmap.pbtxt -o D:/Semestre/graduation_project/files/TensorFlow/workspace/training/annotations/train.record
I had a space between graduation project
I also had the same issue. After a whole day of search I figured out the solution!
We need to put those file names in inverted comma ("myFile") which have blank space in their names(my File).
Example:
Convert this:
python generate_tfrecord.py -x D:/Semestre/graduation project/files/TensorFlow/workspace/training/images/train -l D:/Semestre/graduation project/files/TensorFlow/workspace/training/annotations/labelmap.pbtxt -o D:/Semestre/graduation project/files/TensorFlow/workspace/training/annotations/train.record
To this:
python generate_tfrecord.py -x D:/Semestre/"graduation project"/files/TensorFlow/workspace/training/images/train -l D:/Semestre/"graduation project"/files/TensorFlow/workspace/training/annotations/labelmap.pbtxt -o D:/Semestre/"graduation project"/files/TensorFlow/workspace/training/annotations/train.record
In Short : put those filenames in inverted commas who are having space in between.
My Files to "My Files"
Hope this would help:)
Mac OS Sierra.
In terminal, while trying to execute a .sh file that involves a Python script with Fortran portions, I got this message:
lenscov-master Roger$ ./run_covariances.sh recompile
rm *.o *.so
rm: *.so: No such file or directory
make: [clean] Error 1 (ignored)
gfortran -fPIC -c *.f -lgfortran -lifcore
f2py-2.7 -c loop_lensing.f90 *.o -m loop_lensing --opt=-ffixed-line-length-
none --opt=-O3
/bin/sh: f2py-2.7: command not found
make: *** [loop_lensing] Error 127
However, it is fine just test-running the .f90 file:
f2py -c loop_lensing.F90 -m test
returns a bunch of normal-looking information.
Does anyone maybe know what is going on?
it is fine just test-running the .f90 file
means you have f2py installed. But the script use f2py-2.7
You need to check the version of installed f2py, and make sure f2py-2.7 redirects to the corrent f2py.
The script (or a Makefile) tries to invoke f2py-2.7 instead of f2py. If it is your script or you can easily adjust it, rename all f2py-2.7 to f2py. Otherwise you have to tell us more about the script and show the code of the script.
As foodtooth says, make sure you have f2py 2.7 and not f2py-3, but I don't expect that to be a problem.
You could also make a symlink f2py -> f2py-2.7 for the script.
I am running this SIFT program at this site: https://github.com/sanchom/sjm
All the stuffs go well until I run my program:
$ python extract_caltech.py --dataset_path=[path_to_your_101_Categories_directory] \
--process_limit [num_processes_to_spawn] --sift_normalization_threshold 2.0 -- sift_discard_unnormalized \
--sift_grid_type FIXED_3X3 --sift_first_level_smoothing 0.66 --sift_fast --sift_multiscale \
--features_directory [path_for_extracted_features]
In the output, I see this line thousands of times:
ERROR: unknown command line flag 'logtostderr'
I have checked for some solutions as suggested here:
https://code.google.com/p/google-glog/issues/detail?id=17&q=glog%20gflagsBut
What I did is to add GLOG_logtostderr=1 before I run my program:
GLOG_logtostderr=1 ./my_application
But it did not work our for me.
As far as I know, its the problem related to linking between Gflags and Glog. But i haven't got any ideas on how to solve it yet. Please help. Thanks!
$GLOG_logtostderr=1 isn't doing what you expect. $name means "replace this with the value of the environment variable name". But you want to define a new variable. Use this instead:
GLOG_logtostderr=1 ./my_application
(i.e. omit the $).
I have solved my problem. Its because IIRC macports' glog is not built with gflags but the python script sets --logtostderr. So just remove --logtostderr from the python script by running the script:
find . -name '*.py' -exec perl -i -p -e 's/--logtostderr//' {} \;
To find out if you're affected, run
ldd libglog.so
and check if libgflags is in the output.
The solution is suggested from this site:
https://code.google.com/p/google-glog/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary&groupby=&sort=&id=206
I start in the Vim src directory
$ pwd
~/vim/src
$ ./configure \
> --prefix=$HOME/Applications/vim-compiled \
> --enable-rubyinterp=yes \
> --enable-pythoninterp=yes \
> --with-python-config-dir=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config
$ make
At the end of make, I get the following error
ld: warning: in /Library/Frameworks//Python.framework/Python, missing required architecture x86_64 in file
Undefined symbols:
<very long list of Undefined symbols>
...
...
...
<very long list of Undefined symbols>
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [vim] Error 1
What's causing the error? I've found answers in similar questions that advise using MacPorts, Homebrew, or MacVim. I don't want to use any of those. Is there some other way around?
UPDATE: This is the output listing the Undefined symbols http://pastebin.com/ggV87ReF
In my case I've installed MacVim on 10.6.8 using the following command
./configure --prefix=/usr --enable-perlinterp=yes --enable-pythoninterp=yes --with-features=huge --with-python-config-dir=/System/Library/Frameworks/Python.framework/Versions/2.6
sudo make
Have you tried upgrading to the OSX 32-bit/64-bit version of Python 2.7.2? I'm not sure if there was a specific 64-bit version of 2.7, and that might be causing problems.
Take a look at the Homebrew recipe for vim (or macvim) and modify it if necessary. https://github.com/mxcl/homebrew