[PYTHON] Package management in Maya-try putting pip in mayapy

What is this?

Try installing ** pip ** with mayapy. This is a continuation of this article. If you say "mayapy ...?", I think you should read it first.

mayapy --Python in Maya http://qiita.com/it_ks/items/5045c99461cb6edef761

Premise

Package management

There seem to be several ways (tools) to manage Python packages. This time, refer to the contents here

Python package management technology summary (pip, setuptools, easy_install, etc) http://www.yunabe.jp/docs/python_package_management.html

Select ** pip **, which is considered to be the most modern as of December 2014.

pip ** Official documentation ** about installing

https://pip.pypa.io/en/stable/installing/

Articles explained in Japanese

How to use pip (2014/1 version) @ I'll write it somehow. http://tdoc.info/blog/2014/01/15/pip.html

In addition, it should be noted It seems that it is ** included ** in Python 2.7.9 or later. So, the version of Maya embedded Python will be upgraded soon, You will be able to use pip without doing anything.

As of Maya2016, mayapy is ** Python 2.7.6 **.

Installation

get-pip.py Download get-pip.py from the official documentation and Hit this in Python and you're done. As of 20160103, download from here> https://bootstrap.pypa.io/get-pip.py Or here too> https://raw.github.com/pypa/pip/master/contrib/get-pip.py

Here, instead of so-called Python, ** mayapy ** takes on that role. In other words

python get-pip.pymayapy get-pip.py

is.

Run

  1. Right-click cmd and select "** Run as administrator **" to launch it.
  2. Use cd to move to where mayapy is

cd "C:\Program Files\Autodesk\Maya2016\bin"

  1. mayapy "path\to\get-pip.py"

log

python


$ mayapy "path\to\get-pip.py"
Collecting pip
  Using cached pip-7.1.2-py2.py3-none-any.whl
Collecting setuptools
  Using cached setuptools-19.2-py2.py3-none-any.whl
Collecting wheel
  Using cached wheel-0.26.0-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-7.1.2 setuptools-19.2 wheel-0.26.0

Successfully installed pip-7.1.2 setuptools-19.2 wheel-0.26.0 That's why

Has been installed.

python


> mayapy "path\to\get-pip.py"
Collecting pip
  Using cached pip-7.1.2-py2.py3-none-any.whl
Collecting setuptools
  Downloading setuptools-19.2-py2.py3-none-any.whl (463kB)
    100% |################################| 466kB 568kB/s
Collecting wheel
  Using cached wheel-0.26.0-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
Exception:
Traceback (most recent call last):
  File "c:\users\{user}\appdata\local\temp\tmpj8cvx2\pip.zip\pip\basecommand.py", line 211, in main
    status = self.run(options, args)
  File "c:\users\{user}\appdata\local\temp\tmpj8cvx2\pip.zip\pip\commands\install.py", line 311, in run
    root=options.root_path,
  File "c:\users\{user}\appdata\local\temp\tmpj8cvx2\pip.zip\pip\req\req_set.py", line 646, in install
    **kwargs
  File "c:\users\{user}\appdata\local\temp\tmpj8cvx2\pip.zip\pip\req\req_install.py", line 803, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "c:\users\{user}\appdata\local\temp\tmpj8cvx2\pip.zip\pip\req\req_install.py", line 998, in move_wheel_files
    isolated=self.isolated,
  File "c:\users\{user}\appdata\local\temp\tmpj8cvx2\pip.zip\pip\wheel.py", line 339, in move_wheel_files
    clobber(source, lib_dir, True)
  File "c:\users\{user}\appdata\local\temp\tmpj8cvx2\pip.zip\pip\wheel.py", line 310, in clobber
    ensure_dir(destdir)
  File "c:\users\{user}\appdata\local\temp\tmpj8cvx2\pip.zip\pip\utils\__init__.py", line 71, in ensure_dir
    os.makedirs(path)
  File "C:\Program Files\Autodesk\Maya2016\bin\python27.zip\os.py", line 157, in makedirs
    mkdir(name, mode)
WindowsError: [Error 5]Access denied.: 'C:\\Program Files\\Autodesk\\Maya2016\\Python\\Lib\\site-
packages\\pip'

… Access is denied and the installation cannot be completed.

result

There is a folder called ** "Python" ** under the Maya installation folder, It will be placed there with the following feelings.

mayapy's PYTHON HOME


>>> import os
>>> os.environ['PYTHONHOME']
'C:\\Program Files\\Autodesk\\Maya2016\\Python'

Scripts folder

A ** "Scripts" ** folder will be created directly underneath. Related exes such as "easy_install.exe", "pip.exe" and "wheel.exe" are placed.

Lib > site-packages Various will be added. pip.png Difference between before and after execution. The right column is after. Light blue is a new item.

import pip You will be able to import pip with mayapy. mayapy_pip.png It's a confirmation like "Oh, it's working".

Summary

With administrator privileges mayapy get-pip.py that's all.

This time I will "try to put it in", so the contents from here onwards will be on another occasion (?)

This is all you can do to pollute the environment. The formation of chaos is at your own risk! ←

Recommended Posts

Package management in Maya-try putting pip in mayapy
Python package management in IntelliJ
About package management with conda and pip
Python installation and package management with pip
Install Python package management tool pip (Windows)
mod_wsgi talks about putting it in with pip
Note when putting lxml of python package in ubuntu 14.04
mayapy --Python in Maya
Put pip in Blender
Anaconda Package Management Notes
[Package management] Installation destination and internal processing of apt and pip