<< 3/3

Installed python cgkit and sitex air renderer under Windows10

最後のPython2.7の64bit版をwindows10にインストールしました。
python cgkitをインストールし、旧RenderMan互換レンダラーであるsitex air rendererを利用することにしました。

■手順
以下からいくつかのライブラリをダウンロードします。

http://www.lfd.uci.edu/~gohlke/pythonlibs/


■pipの設定
>python -m pip install --upgrade pip
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pip
Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
|################################| 1.4MB 591kB/s
Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
Successfully uninstalled pip-19.2.3
Successfully installed pip-20.0.2

■pygameインストール
>pip install pygame-1.9.6-cp27-cp27m-win_amd64.whl
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Processing c:\users\yokamak\downloads\pygame-1.9.6-cp27-cp27m-win_amd64.whl
Installing collected packages: pygame
Successfully installed pygame-1.9.6

■odeインストール
>pip install ode-0.15.2-cp27-cp27m-win_amd64.whl
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Processing c:\users\yokamak\downloads\ode-0.15.2-cp27-cp27m-win_amd64.whl
Installing collected packages: ode
Successfully installed ode-0.15.2

■PyOpenGLインストール
>pip install PyOpenGL-3.1.5-cp27-cp27m-win_amd64.whl
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Processing c:\users\yokamak\downloads\pyopengl-3.1.5-cp27-cp27m-win_amd64.whl
Installing collected packages: PyOpenGL
Successfully installed PyOpenGL-3.1.5

■cgkitインストール
>pip install cgkit-2.0.0-cp27-none-win_amd64.whl
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Processing c:\users\yokamak\downloads\cgkit-2.0.0-cp27-none-win_amd64.whl
Installing collected packages: cgkit
Successfully installed cgkit-2.0.0

■インストールしたものの内容確認
C:\Users\yokamak\Downloads>pip freeze
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
cgkit==2.0.0
ode==0.15.2
pygame==1.9.6
PyOpenGL==3.1.5

■PILのダミーをインストール、自動的にPillowがインストール
>pip install "PIL-2.0+dummy-py2.py3-none-any.whl"
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Processing c:\users\yokamak\downloads\pil-2.0+dummy-py2.py3-none-any.whl
Collecting Pillow>=2.0
Downloading Pillow-6.2.2-cp27-cp27m-win_amd64.whl (1.9 MB)
|################################| 1.9 MB 3.0 MB/s
Installing collected packages: Pillow, PIL
Successfully installed PIL-2.0+dummy Pillow-6.2.2

■python cgkitの動作確認。

\cgkit>viewer.py demo1.py
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html

\cgkit>viewer.py demo2.py
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html

\cgkit>viewer.py demo3.py
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html


■テクスチャを貼るシーンのロード失敗。Pillowは対応しない。

\cgkit>viewer.py simplescene.py
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Texname: 1
Loading "uvmap.png"...
Traceback (most recent call last):
File "C:\Python27\Scripts\viewer.py", line 699, in
viewer.run()
File "C:\Python27\lib\site-packages\cgkit\tool.py", line 198, in run
self.action()
File "C:\Python27\Scripts\viewer.py", line 384, in action
self.draw(self.cam, self.width, self.height)
File "C:\Python27\Scripts\viewer.py", line 676, in draw
renderer.paint(root)
File "C:\Python27\lib\site-packages\cgkit\glmaterial.py", line 105, in loadTexData
self._passPILImage(img)
File "C:\Python27\lib\site-packages\cgkit\glmaterial.py", line 141, in _passPILImage
self.texData(w, h, format, GL_UNSIGNED_BYTE, img.tostring())
File "C:\Python27\lib\site-packages\PIL\Image.py", line 779, in tostring
"tostring() has been removed. Please call tobytes() instead."
NotImplementedError: tostring() has been removed. Please call tobytes() instead.

■レンダリングの確認、scitex air rendererを使用する。

\cgkit>render.py -rair demo1.py
Exporting main.rib...
1 passes...
Compiling shaders...
Preprocessing time: 0s
Rendering "out.tif" (frame 0)...
Rendering time: 2s

\cgkit>render.py -rair demo2.py
Exporting main.rib...
1 passes...
Compiling shaders...
Preprocessing time: 0s
Rendering "out.tif" (frame 0)...
Rendering time: 1s

■PILの削除
\cgkit>pip uninstall PIL
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Found existing installation: PIL 2.0+dummy
Uninstalling PIL-2.0+dummy:
Would remove:
c:\python27\lib\site-packages\pil-2.0+dummy.dist-info\*
Proceed (y/n)? y
Successfully uninstalled PIL-2.0+dummy

■内容確認
\cgkit>pip list
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Package Version
---------- -------
cgkit 2.0.0
ode 0.15.2
Pillow 6.2.2
pip 20.0.2
pygame 1.9.6
PyOpenGL 3.1.5
setuptools 41.2.0

■Pillowの削除
\cgkit>pip uninstall Pillow
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Found existing installation: Pillow 6.2.2
Uninstalling Pillow-6.2.2:
Would remove:
c:\python27\lib\site-packages\pil\*
c:\python27\lib\site-packages\pillow-6.2.2.dist-info\*
Proceed (y/n)? y
Successfully uninstalled Pillow-6.2.2

■内容確認
\cgkit>pip list
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Package Version
---------- -------
cgkit 2.0.0
ode 0.15.2
pip 20.0.2
pygame 1.9.6
PyOpenGL 3.1.5
setuptools 41.2.0

■PILのインストール
最後にpython cgkitは、pillowではなくてPILでないとテクスチャがはりつけられないので、Windows用のbinary installした。
thank you. ありがとうございます。

PIL-1.1.7.win-amd64-py2.7.exe

■Windows Compiled Libraries
以下からダウンロード

https://github.com/lightkeeper/lswindows-lib/blob/master/amd64/python/PIL-1.1.7.win-amd64-py2.7.exe?raw=true

sitex air rendererのダウンロード


http://www.sitexgraphics.com/html/download.html

python cgkitのサンプル


cgkitサイトのtutorialからdemoファイルを入手します。
http://cgkit.sourceforge.net/tutorials/demo1.html
http://cgkit.sourceforge.net/tutorials/demo2.html
http://cgkit.sourceforge.net/tutorials/demo3.html


コマンドプロンプトから
 > viewer.py demo3.py

マウス alt+左ドラッグでカメラ目線。

sitex air rendererでレンダリングの確認
 > render.py -rair demo3.py


以下は
http://cgkit.sourceforge.net/tutorials/renderman.html
 > render.py -rair simplescene.py

cgkiA.jpg
ありがとうございます。
  • -
  • -

Installed python cgkit on Mx Linux21.3 using python2.7

LANG=C xdg-user-dirs-gtk-update
sudo apt update
sudo apt upgrade
sudo apt install build-essential

sudo apt install python-is-python2
sudo apt install python2-dev
sudo apt install libode-dev
sudo apt install lib3ds-dev
sudo apt install freeglut3-dev
sudo apt install libboost-all-dev

■Download cgkit.
https://sourceforge.net/p/cgkit/code/ci/master/tree/


glmaterial.py, line 141, in _passPILImage
self.texData(w, h, format, GL_UNSIGNED_BYTE, img.tostring())

replaced tostring() with tobytes().

self.texData(w, h, format, GL_UNSIGNED_BYTE, img.tobytes())

■Download PyProtocol.
http://peak.telecommunity.com/dist/

■Download get-pip.py for 2.7.
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
# python get-pip.py


mak@mx:~/.local/bin
$ ./pip install pygame
$ ./pip install pyopengl
$ ./pip install serial
$ ./pip install pyode
$ ./pip install pillow
$ ./pip install scons

$ unzip PyProtocols-0.9.3.zip
$ sudo python setup.py --without-speedups install

$ ./pip list
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Package Version
----------- -------
future 0.18.3
iso8601 0.1.16
Pillow 6.2.2
pip 20.3.4
pygame 2.0.3
PyODE 1.2.1
PyOpenGL 3.1.7
PyProtocols 0.9.3
PyYAML 5.4.1
scons 3.1.2
serial 0.0.97
setuptools 44.1.1
wheel 0.37.1




$ cd ~/Downloads/cgkit-code/utilities/
mak@mx:~/Downloads/cgkit-code/utilities
$ python checkenv.py
----------------------------------------------------------------------
Python 2.7.18 (default, Jul 14 2021, 08:11:37)
[GCC 10.2.1 20210110]
Platform: linux2
----------------------------------------------------------------------
Python version: 2.7........... OK
PyProtocols................... is installed
PyOpenGL...................... is installed
PIL........................... is installed
pygame........................ pygame 2.0.3 (SDL 2.0.16, Python 2.7.18)
Hello from the pygame community. https://www.pygame.org/contribute.html
is installed
PyODE......................... is installed
PySerial...................... is installed
cgkit (base).................. missing
cgkit (C++ lib)............... failed

The cgkit supportlib could not be imported. One possible reason for that
is that shared libraries (such as the boost_python runtime or OpenGL)
could not be found.

cgkit (all)................... failed


$ ls /usr/lib/x86_64-linux-gnu/libboost_python*.*
/usr/lib/x86_64-linux-gnu/libboost_python39.a
/usr/lib/x86_64-linux-gnu/libboost_python39.so
/usr/lib/x86_64-linux-gnu/libboost_python39.so.1.74.0

■Download following:
libboost-python1.67.0_1.67.0-17ubuntu8_amd64.deb
libboost-python1.67-dev_1.67.0-17ubuntu8_amd64.deb

$ dpkg -x libboost-python1.67.0_1.67.0-17ubuntu8_amd64.deb usr
$ dpkg -x libboost-python1.67-dev_1.67.0-17ubuntu8_amd64.deb usr

■Copy following:
libboost_python27.so
libboost_python27.so.1.67.0
libboost_python27.a


$ sudo cp libboost_python27*.* /usr/lib/x86_64-linux-gnu/

$ ls /usr/lib/x86_64-linux-gnu/libboost_python*.*
/usr/lib/x86_64-linux-gnu/libboost_python27.a
/usr/lib/x86_64-linux-gnu/libboost_python27.so
/usr/lib/x86_64-linux-gnu/libboost_python27.so.1.67.0
/usr/lib/x86_64-linux-gnu/libboost_python39.a
/usr/lib/x86_64-linux-gnu/libboost_python39.so
/usr/lib/x86_64-linux-gnu/libboost_python39.so.1.74.0

$ ls /usr/lib/x86_64-linux-gnu/lib3ds*.*
/usr/lib/x86_64-linux-gnu/lib3ds-1.so
/usr/lib/x86_64-linux-gnu/lib3ds-1.so.3.0.0
/usr/lib/x86_64-linux-gnu/lib3ds-1.so.3
/usr/lib/x86_64-linux-gnu/lib3ds.so

■scons
$ /home/mak/.local/bin/scons

■changed config.cfg
######################################################################
# Boost.Python settings
######################################################################

# Name of the Boost.Python library to link with
BOOST_LIB = "boost_python27"


####### Libd3DS #######

LIB3DS_AVAILABLE = True
LIB3DS_PATH = r"/usr/lib/x86_64-linux-gnu/"

#LIB3DS_LIBNAME = "lib3ds-120s"


■Build cgkit.
$ python setup.py build


1.Build error;

wrappers/py_arrayslots1.cpp: In function ‘void class_ArraySlots()’:
wrappers/py_slot.h:43:75: error: unable to find string literal operator ‘operator""sname’ with ‘const char [11]’, ‘long unsigned int’ arguments
43 | #define ARRAYSLOT(sname,stype) class_<_ArraySlotIterator >("_"sname"_Iterator", init&>()) \
| ^~~~~~~~~~~
wrappers/py_slot.h:43:75: note: in definition of macro ‘ARRAYSLOT’
43 | #define ARRAYSLOT(sname,stype) class_<_ArraySlotIterator >("_"sname"_Iterator", init&>()) \
| ^~~~~~~~~~~
wrappers/py_slot.h:43:75: error: unable to find string literal operator ‘operator""sname’ with ‘const char [11]’, ‘long unsigned int’ arguments
43 | #define ARRAYSLOT(sname,stype) class_<_ArraySlotIterator >("_"sname"_Iterator", init&>()) \
| ^~~~~~~~~~~
wrappers/py_slot.h:43:75: note: in definition of macro ‘ARRAYSLOT’
43 | #define ARRAYSLOT(sname,stype) class_<_ArraySlotIterator >("_"sname"_Iterator", init&>()) \
|


1.Build error;

[solved]
py_slot.h,line:43, Put blank spaces on both sides of sname.

>("_" sname "_Iterator",



2.Build error;

wrappers/py_geoms1.cpp: In member function ‘boost::python::api::object _VariableIterator::next()’:
wrappers/py_geoms1.cpp:145:24: error: could not convert ‘std::make_tuple(_Elements&& ...) [with _Elements = {std::__cxx11::basic_string, std::allocator >&, const support3d::VarStorage&, const support3d::VarType&, const int&}](info.support3d::PrimVarInfo::storage, info.support3d::PrimVarInfo::type, info.support3d::PrimVarInfo::multiplicity)’ from ‘std::tuple, std::allocator >, support3d::VarStorage, support3d::VarType, int>’ to ‘boost::python::api::object’
145 | return make_tuple(name, info.storage, info.type, info.multiplicity);
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| std::tuple, std::allocator >, support3d::VarStorage, support3d::VarType, int>
wrappers/py_geoms1.cpp: In function ‘boost::python::api::object findVariable(support3d::GeomObject*, std::string)’:
wrappers/py_geoms1.cpp:166:22: error: could not convert ‘std::make_tuple(_Elements&& ...) [with _Elements = {std::__cxx11::basic_string, std::allocator >&, support3d::VarStorage&, support3d::VarType&, int&}](info->support3d::PrimVarInfo::storage, info->support3d::PrimVarInfo::type, info->support3d::PrimVarInfo::multiplicity)’ from ‘std::tuple, std::allocator >, support3d::VarStorage, support3d::VarType, int>’ to ‘boost::python::api::object’
166 | return make_tuple(name, info->storage, info->type, info->multiplicity);
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| std::tuple, std::allocator >, support3d::VarStorage, support3d::VarType, int>
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

2.Build error;
[solved]
py_geoms1.cpp,line:145 and line:166 boost::python::make_tuple

replaced make_tuple with boost::python::make_tuple.

---------------------------------------------------------------------------

■Install cgkit.
sudo python setup.py install --record files.txt

if you uninstall cgkit...
cat files.txt | sudo xargs rm -rf

mak@mx:~/Downloads/cgkit-code/utilities
$ python checkenv.py
-------------------------------------------------do ---------------------
Python 2.7.18 (default, Jul 14 2021, 08:11:37)
[GCC 10.2.1 20210110]
Platform: linux2
----------------------------------------------------------------------
Python version: 2.7........... OK
PyProtocols................... is installed
PyOpenGL...................... is installed
PIL........................... is installed
pygame........................ pygame 2.0.3 (SDL 2.0.16, Python 2.7.18)
Hello from the pygame community. https://www.pygame.org/contribute.html
is installed
PyODE......................... is installed
PySerial...................... is installed
cgkit (base).................. 2.0.0 (Aug 12 2023)
cgkit (C++ lib)............... OK
cgkit (all)................... OK


$ viewer.py -N softimage demo1.py

$ viewer.py -N softimage demo4.py
pygame 2.0.3 (SDL 2.0.16, Python 2.7.18)
Hello from the pygame community. https://www.pygame.org/contribute.html
Texname: 1
Loading "maps/uvmap.png"...

texturing is ok.
It is light and fun.

but pyode1.2.1 is old?
$ viewer.py -N softimage piddemo1.py
The ball moves freely.

Thank you for your support.
  • -
  • -

<< 3/3