A story that suffered from OS differences when trying to implement a dissertation

image.png

There is a Research to freely generate human bodies with various body shapes and poses, and a program that runs on Python is distributed (although it is a registration system). We are doing it.

In the README

System Requirements:
====================
Operating system: OSX, Linux

Because it says, Windows is not supposed. That said, I thought it would work, and in the end I was able to run it in my environment (Windows10 64bit), but I heard that I had a lot of trouble.

Trap 1 needs to pass

This was a note wrap personally, but for the time being. I have my own module stored locally, so I need to put it in my PATH. As stated in the README, on Mac at the end of .bash_profile in your home directory

SMPL_LOCATION=~/smpl
export PYTHONPATH=$PYTHONPATH:$SMPL_LOCATION

Add the letters.

In Windows, you need to set your own by going to Control Panel> User Account> User Account (Why in such a strange place ...) and "Change Environment Variables".

Trap 2 Python series is 2

This was solved in an instant, but it was a trap. Since the statement of the program is Python 2 series, the Python environment to be used must also be 2 series. If the versions are different, the format of the print statement is different in the first place, and the modules may not be complete before such a trivial problem, so it is extremely rare that it can be executed as it is.

SyntaxError: Missing parentheses in call to 'print'. Did you mean print(…)?

If you get the error, it is highly likely that you are running a 2-series program with 3-series Python.

Trap 3 module name is slightly different

I need Numpy, Scipy, Chumpy, ʻOpenCV in the README, and of course I will install it with pip, but the last ʻOpenCV does not hit. If you execute it as it is, it is said that it is useless if there is no module called cv2, so you can not try typing with cv2. In terms of results,

pip install opencv-python

Was the correct answer. Well, it may be common sense in the neighborhood ...

Trap 4 EOFError

It used to be like an outpost, but now it's a real trap **. If you think that the environment is safe and you want to execute it, you will get the following error.

Traceback (most recent call last):
  File "hello_smpl.py", line 48, in <module>
    m = load_model( '../../models/basicModel_f_lbs_10_207_0_v1.0.0.pkl' )
  File "C:\Users\~~~\smpl\smpl_webuser\serialization.py", line 116, in load_model
    dd = ready_arguments(fname_or_dict)
  File "C:\Users\~~~\smpl\smpl_webuser\serialization.py", line 80, in ready_arguments
    dd = pickle.load(open(fname_or_dict))
EOFError

When I google with ʻEOF Error`, there is a warning that appears when reading an empty file, but the file can be specified properly. Also, the error message is slightly different from the one that appears in the case. Apparently it doesn't really matter if the file is empty or not. I was wondering what this meant for a while, but when I proceeded with the investigation after that,

On Windows, when dealing with binary files in the pickle module, you need to specify that with characters,

It seems that. [(Reference article)](https://ja.stackoverflow.com/questions/18992/python-pickle%E3%81%AE%E3%83%95%E3%82%A1%E3%82%A4%E3 % 83% AB% E3% 83% A2% E3% 83% BC% E3% 83% 89-% E3% 83% 90% E3% 82% A4% E3% 83% 8A% E3% 83% AA% E3% 83% A2% E3% 83% BC% E3% 83% 89% E3% 81% AE% E5% BF% 85% E7% 84% B6% E6% 80% A7) Specifically, it's in the included serialization.py

dd = pickle.load(open(fname_or_dict))

The sentence

dd = pickle.load(open(fname_or_dict,`rb`))

Must be. Now you can finally do it. At least in my environment.

Later, when I tested it on my MacBook Pro, I didn't see this problem on Mac OS X. Difference in OS …….

Trap that could not be solved opendr

When I try to run another sample program, it says that there is no module called ʻopendr. Then I thought I'd do pip` ... but an error. When I read the error message, I was asked to insert C ++ Compiler, so I entered it and tried again. But,

    LINK : warning LNK4044:option'/lstdc++'Is invalid. It will be ignored.
    LINK : fatal error LNK1181:Input file'OSMesa.lib'I can't open it.
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\link.exe' failed with exit status 1181

When I search, I find similar cases, but the file in question (ʻOSMesa.lib) is different, so it seems that it cannot be diverted. And if you check this ʻOS Mesa, you can see that it is a library installed in Linux.

No error when I tried it on a MacBook Pro. It seems that it was a module for displaying the viewer on 3D. But here too, the OS is different ...

What I thought

There are many differences in versions and OSs ...

Recommended Posts

A story that suffered from OS differences when trying to implement a dissertation
A story that failed when trying to remove the suffix from the string with rstrip
A story that got stuck when trying to upgrade the Python version on GCE
A story about trying to implement a private variable in Python.
A story that I was addicted to calling Lambda from AWS Lambda.
A story about trying to automate a chot when cooking for yourself
A story that I fixed when I got Lambda logs from Cloudwatch Logs
A story I was addicted to when inserting from Python to a PostgreSQL table
Points to note when switching from NAOqi OS 2.4.3 to 2.5.5
A story that I was addicted to when I made SFTP communication with python
A program that failed when trying to create a linebot with reference to "Dialogue system made with python"
A story that made it possible to automatically create anison playlists from your music files
A story that stumbled when I made a chatbot with Transformer
A story about creating a UNIX / Linux compatible OS from scratch
A story that stumbled when using pip in a proxy environment
Technology that supports jupyter: traitlets (story of trying to decipher)
[Python] A story that seemed to fall into a rounding trap
A story that didn't work when I tried to log in with the Python requests module
The story of the algorithm drawing a ridiculous conclusion when trying to solve the traveling salesman problem properly
About the error I encountered when trying to use Adafruit_DHT from Python on a Raspberry Pi
Phenomenon that characters disappear when trying to enter one character without Enter
The story that a hash error came out when using Pipenv
A story that struggled to handle the Python package of PocketSphinx
A story that was struggling to loop processing 3 million ID data
A memo when connecting bluetooth from a smartphone / PC to Raspberry Pi 4
The story that the guard was confined when the laboratory was converted to IoT
A story when a beginner gets stuck trying to build a vim 8.2 + python 3.8.2 + lua plugin environment on Ubuntu 18.04.4 LTS
A story about creating a program that will increase the number of Instagram followers from 0 to 700 in a week