CadQuery(CQ-editor)インストール

Pythonで3Dモデリングが出来るソフトウェア「CadQuery」のインストール方法を紹介します。

CadQueryそのままで使用するのはコマンドライン操作となって敷居が高いため、GUIを備えた「CQ-editor」というエディタがあります。

Wikiを参照すると、以下のようなインストール方法があります。

Windows環境を前提にすると、pip経由でのインストールが一番適していると思います。

Pythonの導入から解説します。

 

手っ取り早いインストール方法(Windows)

Windows10 / 11 の最新版であれば以下の手順でインストール完了します。

 

  1. 「管理者権限」で「ターミナル」、「コマンドプロンプト」、「PowerShell」のいずれかのターミナルを起動
  2. winget install -e --scope machine --id Python.Python.3.12」入力でPythonインストール
  3. Pythonインストールを反映させるために、一度ターミナルを閉じて「管理者権限」で起動しなおす
  4. python -m pip install --upgrade pip」入力でPyPI(pip)アップデート
  5. pip install CQ-editor」入力でCadQuery(CQ-editor)インストール
  6. 「C:\Program Files\Python312\Scripts\CQ-editor.exe」を起動する(ショートカット作成すると便利)

 

詳細な解説は、以下セクションを読み進めてください。

 

Python の導入(Windows)

CadQuery(CQ-editor)はPython環境上で動作するソフトウェアです。

そのため、まず最初にPythonを導入する必要があります。

現在、2025年 05月 時点でリリースされている CQ-editor のバージョン(0.3.0、0.3.dev0、0.4.0、0.5.0)では Python バージョン 3.9 以上 3.13 未満が必要とのことで、最新のものをと考えると Python 3.12 をインストールすることになると思います。

Python 3.13 では動作しないので、バージョンに注意しつつPythonを導入します。

 

CQ-editor以外にもPythonを使う場合には、バージョンの兼ね合いでライブラリが使えなかったり、依存関係を解決できない場合があります。

そのため、virtualenv等のPython仮想環境を使用することがあります。

今回は仮想環境についての解説はしませんが、もし使用する場合にはPythonはマシンインストールではなくユーザーインストールにすることをおすすめしておきます。

以下の解説では、CQ-editorのみを対象としてWindows環境上で動かす場合のPythonのインストール方法とします。

個人的なオススメはwingetを使用する方法です。

 

公式サイトからPythonインストーラーをダウンロードする方法

Pythonの公式サイトからインストーラーをダウンロードしてきて、手動でインストールする方法です。

こちらから 3.12 系のインストーラーをダウンロードします。

指示に従ってインストールします。

PATHを追加しておくと良いでしょう。

他、ストアからインストールする方法もあります。

 

wingetの使用

最近の Windows 10 / 11 では、wingetというパッケージ管理システムが使用できるようになっています。

コマンドラインから操作するだけで必要なソフトがインストール出来るため便利です。

「ターミナル」、「コマンドプロンプト」、「PowerShell」のいずれかのターミナルを起動して、コマンドを入力していきましょう。

ここで重要なのが、管理者権限で起動することです。

ターミナル起動時に右クリックメニューより「管理者として実行」を選択し、管理者権限で起動します。

開いたウィンドウタイトルに「管理者」と表示され、管理者権限で起動していることを確認しましょう。

 

winget初回起動時の同意画面

wingetコマンドでは最初の使用時に以下のように同意が求められる場合があります。 Yで同意して進めましょう。

'msstore' ソースでは、使用する前に次の契約を表示する必要があります。
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
ソースが正常に機能するには、現在のマシンの 2 文字の地理的リージョンをバックエンド サービスに送信する必要があります (例: "US")。

すべてのソース契約条件に同意しますか?
[Y] はい  [N] いいえ: 

 

winget経由でのパッケージ探し

以下のようにパッケージを検索することができます。

>winget search Python
名前                                 ID                             バージョン     一致            ソース
----------------------------------------------------------------------------------------------------------
Python 3.13                          9PNRBTZXMB4Z                   Unknown                        msstore
Python 3.12                          9NCVDN91XZQP                   Unknown                        msstore
Python 3.11                          9NRWMJP3717K                   Unknown                        msstore
Python 3.10                          9PJPW5LDXLZ5                   Unknown                        msstore
Python 3.9                           9P7QFQMJRFP7                   Unknown                        msstore
Python 3.7                           9NJ46SX7X90P                   Unknown                        msstore
Python 3.8                           9MSSZTT1N39L                   Unknown                        msstore
计算机二级 Python 考试题库           9PBKTNDS9VSH                   Unknown                        msstore
Python Install Manager (Beta)        9NQ7512CXL7T                   Unknown                        msstore
C++ to Python Converter              9PBVQZ72QDQN                   Unknown                        msstore
C# to Python Converter               9MT2RMZQ7G01                   Unknown                        msstore
Java to Python Converter             9N9LXQNBTDCG                   Unknown                        msstore
计算机二级Python拿证直通车——进取培优 9PBTKNMGD0SD                   Unknown                        msstore
Python-UWP サンプルアプリ            9NVWVDL6P14H                   Unknown                        msstore
Anaconda3                            Anaconda.Anaconda3             2024.10-1      Command: python winget
Miniconda3                           Anaconda.Miniconda3            py313_25.3.1-1 Command: python winget
Mambaforge                           CondaForge.Mambaforge          24.11.0-1      Command: python winget
Mambaforge-pypy3                     CondaForge.Mambaforge.PyPy3    24.11.0-1      Command: python winget
Miniforge3                           CondaForge.Miniforge3          25.3.0-3       Command: python winget
Miniforge-pypy3                      CondaForge.Miniforge3.PyPy3    24.11.0-1      Command: python winget
Python Launcher                      Python.Launcher                3.12.0         Command: python winget
Python 2                             Python.Python.2                2.7.18150      Command: python winget
Python 3.0                           Python.Python.3.0              3.0.1          Command: python winget
Python 3.1                           Python.Python.3.1              3.1.4          Command: python winget
Python 3.10                          Python.Python.3.10             3.10.11        Command: python winget
Python 3.11                          Python.Python.3.11             3.11.9         Command: python winget
Python 3.12                          Python.Python.3.12             3.12.10        Command: python winget
Python 3.13                          Python.Python.3.13             3.13.3         Command: python winget
Python 3.2                           Python.Python.3.2              3.2.5          Command: python winget
Python 3.3                           Python.Python.3.3              3.3.5          Command: python winget
Python 3.4                           Python.Python.3.4              3.4.4          Command: python winget
Python 3.5                           Python.Python.3.5              3.5.4          Command: python winget
Python 3.6                           Python.Python.3.6              3.6.8          Command: python winget
Python 3.7                           Python.Python.3.7              3.7.9          Command: python winget
Python 3.8                           Python.Python.3.8              3.8.10         Command: python winget
Python 3.9                           Python.Python.3.9              3.9.13         Command: python winget
BPMN-RPA Studio                      1IC.BPMN-RPAStudio             28.0.0         Tag: python     winget
MessyFileOrganizer                   4ngel2769.MessyOrganizer       1.0.0          Tag: python     winget
Thonny                               AivarAnnamaa.Thonny            4.1.7          Tag: python     winget
以下省略

以下のURLからも Python 3.12 が存在することが確認できます。

インストールコマンドも記載されていますが、オプションをいくつか追加し、以下のコマンドでインストールします。

winget install -e --scope machine --id Python.Python.3.12

ユーザーインストール可能なパッケージはデフォルトでユーザーインストールになってしまうため、明示的に「--scope machine」でマシンインストールを指定しておきます。

ユーザーディレクトリに日本語が含まれる場合の問題回避にもなりますが、Program Files以下にインストールされるため管理者権限が求められます。

-e オプションは大文字小文字の区別を追加しています。

ちなみにインストールオプションを変更したい場合は -i を付けます。(対話型モード)

なお、マシンインストールを指定しているが、ターミナルを管理者権限にしていない場合、

定義済みのソースを開けませんでした; winget メンテナに報告してください。
コマンドの実行中に予期しないエラーが発生しました:
0x80070005

のようなエラーが発生する場合があります。

管理者権限でターミナルを起動することによって解決します。

 

winget経由でのPythonインストール

管理者権限で起動したターミナルで以下のコマンドを入力します。

> winget install -e --scope machine --id Python.Python.3.12
見つかりました Python 3.12 [Python.Python.3.12] バージョン 3.12.10
このアプリケーションは所有者からライセンス供与されます。
Microsoft はサードパーティのパッケージに対して責任を負わず、ライセンスも付与しません。
ダウンロード中 https://www.python.org/ftp/python/3.12.10/python-3.12.10-amd64.exe
  ██████████████████████████████  25.7 MB / 25.7 MB
インストーラーハッシュが正常に検証されました
パッケージのインストールを開始しています...
インストールが完了しました

インストール後には自動でパスが通るようで、コマンドラインで「python」と入力すればPython 3.12.10(今回インストールしたもの)が起動します。(終了はexit())

 

PyPI(pip)のアップデート

※ 必ず新規にターミナルを開き直すこと

winget で Pythonをインストールしたあとに続けようとしてもそのままでは進めません。

先ほどインストールした Python が反映されていないため、ターミナルを一度閉じて、再度、管理者権限で開きましょう。

こちらもユーザーインストールではなく、グローバルにインストールするため、管理者権限で続ける必要があります。

> pip list
Package Version
------- -------
pip     25.0.1

バージョンを確認します。

現在は、25.0.1のようです。

python -m pip install --upgrade pip

コマンドを入力してアップデート確認します。

> pip list
Package Version
------- -------
pip     25.1.1

アップデートされたようです。

 

PyPI(pip)経由でのCadQuery(CQ-editor)インストール

以下のコマンドでインストールします。

pip install CQ-editor

 

依存パッケージが大量に入ります。

Installing collected packages: webencodings, wcwidth, typish, text-unidecode, sortedcontainers, pywin32, PyQtWebEngine-Qt5, PyQt5-Qt5, pure-eval, ptyprocess, pickleshare, fastjsonschema, cadquery-ocp, zipp, whatthepatch, watchdog, urllib3, ujson, typing-extensions, types-python-dateutil, traitlets, tornado, tomlkit, tinycss2, textdistance, tabulate, sphinxcontrib-serializinghtml, sphinxcontrib-qthelp, sphinxcontrib-jsmath, sphinxcontrib-htmlhelp, sphinxcontrib-devhelp, sphinxcontrib-applehelp, soupsieve, snowballstemmer, six, setuptools, rtree, rpds-py, roman-numerals-py, pyzmq, pyyaml, pywin32-ctypes, python-slugify, PyQt5-sip, pyparsing, pylint-venv, pygments, pyflakes, pycparser, pycodestyle, psutil, prompt_toolkit, pluggy, platformdirs, pexpect, pathspec, path, parso, pandocfilters, packaging, numpy, nest-asyncio, mypy-extensions, multimethod, more-itertools, mistune, mdurl, mccabe, MarkupSafe, logbook, jupyterlab-pygments, jellyfish, jaraco.context, isort, intervaltree, inflection, imagesize, idna, fonttools, executing, docutils, dill, diff-match-patch, defusedxml, decorator, debugpy, colorama, cloudpickle, charset-normalizer, chardet, certifi, bleach, bcrypt, babel, attrs, atomicwrites, asttokens, astroid, alabaster, yapf, three-merge, stack_data, requests, referencing, qtpy, qstylizer, pytoolconfig, python-lsp-jsonrpc, python-dateutil, pyqtgraph, pyqt5, pylint, pydocstyle, nlopt, matplotlib-inline, markdown-it-py, jupyter-core, Jinja2, jedi, jaraco.functools, jaraco.classes, importlib-metadata, flake8, ezdxf, comm, click, cffi, casadi, binaryornot, beautifulsoup4, autopep8, sphinx, rich, qtawesome, qdarkstyle, pyqtwebengine, pynacl, keyring, jupyter-client, jsonschema-specifications, ipython, docstring-to-markdown, cryptography, cadquery, black, arrow, rope, python-lsp-server, paramiko, numpydoc, jsonschema, ipykernel, cookiecutter, spyder-kernels, qtconsole, python-lsp-black, pyls-spyder, nbformat, nbclient, nbconvert, spyder, CQ-editor


Successfully installed CQ-editor-0.5.0 Jinja2-3.1.6 MarkupSafe-3.0.2 PyQt5-Qt5-5.15.2 PyQt5-sip-12.17.0 PyQtWebEngine-Qt5-5.15.2 alabaster-1.0.0 arrow-1.3.0 astroid-3.3.10 asttokens-3.0.0 atomicwrites-1.4.1 attrs-25.3.0 autopep8-2.0.4 babel-2.17.0 bcrypt-4.3.0 beautifulsoup4-4.13.4 binaryornot-0.4.4 black-25.1.0 bleach-6.2.0 cadquery-2.5.2 cadquery-ocp-7.7.2 casadi-3.7.0 certifi-2025.4.26 cffi-1.17.1 chardet-5.2.0 charset-normalizer-3.4.2 click-8.2.0 cloudpickle-3.1.1 colorama-0.4.6 comm-0.2.2 cookiecutter-2.6.0 cryptography-44.0.3 debugpy-1.8.14 decorator-5.2.1 defusedxml-0.7.1 diff-match-patch-20241021 dill-0.4.0 docstring-to-markdown-0.17 docutils-0.21.2 executing-2.2.0 ezdxf-1.4.1 fastjsonschema-2.21.1 flake8-7.1.2 fonttools-4.58.0 idna-3.10 imagesize-1.4.1 importlib-metadata-8.7.0 inflection-0.5.1 intervaltree-3.1.0 ipykernel-6.29.5 ipython-8.36.0 isort-6.0.1 jaraco.classes-3.4.0 jaraco.context-6.0.1 jaraco.functools-4.1.0 jedi-0.19.2 jellyfish-1.2.0 jsonschema-4.23.0 jsonschema-specifications-2025.4.1 jupyter-client-8.6.3 jupyter-core-5.7.2 jupyterlab-pygments-0.3.0 keyring-25.6.0 logbook-1.8.1 markdown-it-py-3.0.0 matplotlib-inline-0.1.7 mccabe-0.7.0 mdurl-0.1.2 mistune-3.1.3 more-itertools-10.7.0 multimethod-1.12 mypy-extensions-1.1.0 nbclient-0.10.2 nbconvert-7.16.6 nbformat-5.10.4 nest-asyncio-1.6.0 nlopt-2.9.1 numpy-2.2.5 numpydoc-1.8.0 packaging-25.0 pandocfilters-1.5.1 paramiko-3.5.1 parso-0.8.4 path-17.1.0 pathspec-0.12.1 pexpect-4.9.0 pickleshare-0.7.5 platformdirs-4.3.8 pluggy-1.5.0 prompt_toolkit-3.0.51 psutil-7.0.0 ptyprocess-0.7.0 pure-eval-0.2.3 pycodestyle-2.12.1 pycparser-2.22 pydocstyle-6.3.0 pyflakes-3.2.0 pygments-2.19.1 pylint-3.3.7 pylint-venv-3.0.4 pyls-spyder-0.4.0 pynacl-1.5.0 pyparsing-3.2.3 pyqt5-5.15.11 pyqtgraph-0.13.7 pyqtwebengine-5.15.7 python-dateutil-2.9.0.post0 python-lsp-black-2.0.0 python-lsp-jsonrpc-1.1.2 python-lsp-server-1.12.2 python-slugify-8.0.4 pytoolconfig-1.3.1 pywin32-310 pywin32-ctypes-0.2.3 pyyaml-6.0.2 pyzmq-26.4.0 qdarkstyle-3.2.3 qstylizer-0.2.4 qtawesome-1.3.1 qtconsole-5.5.2 qtpy-2.4.3 referencing-0.36.2 requests-2.32.3 rich-14.0.0 roman-numerals-py-3.1.0 rope-1.13.0 rpds-py-0.24.0 rtree-1.4.0 setuptools-80.4.0 six-1.17.0 snowballstemmer-3.0.1 sortedcontainers-2.4.0 soupsieve-2.7 sphinx-8.2.3 sphinxcontrib-applehelp-2.0.0 sphinxcontrib-devhelp-2.0.0 sphinxcontrib-htmlhelp-2.1.0 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-2.0.0 sphinxcontrib-serializinghtml-2.0.0 spyder-5.5.6 spyder-kernels-2.5.2 stack_data-0.6.3 tabulate-0.9.0 text-unidecode-1.3 textdistance-4.6.3 three-merge-0.1.1 tinycss2-1.4.0 tomlkit-0.13.2 tornado-6.4.2 traitlets-5.14.3 types-python-dateutil-2.9.0.20241206 typing-extensions-4.13.2 typish-1.9.3 ujson-5.10.0 urllib3-2.4.0 watchdog-6.0.0 wcwidth-0.2.13 webencodings-0.5.1 whatthepatch-1.0.7 yapf-0.43.0 zipp-3.21.0

 

pip経由で入ったパッケージを確認してみます。

> pip list
Package                       Version
----------------------------- --------------
alabaster                     1.0.0
arrow                         1.3.0
astroid                       3.3.10
asttokens                     3.0.0
atomicwrites                  1.4.1
attrs                         25.3.0
autopep8                      2.0.4
babel                         2.17.0
bcrypt                        4.3.0
beautifulsoup4                4.13.4
binaryornot                   0.4.4
black                         25.1.0
bleach                        6.2.0
cadquery                      2.5.2
cadquery-ocp                  7.7.2
casadi                        3.7.0
certifi                       2025.4.26
cffi                          1.17.1
chardet                       5.2.0
charset-normalizer            3.4.2
click                         8.2.0
cloudpickle                   3.1.1
colorama                      0.4.6
comm                          0.2.2
cookiecutter                  2.6.0
CQ-editor                     0.5.0
cryptography                  44.0.3
debugpy                       1.8.14
decorator                     5.2.1
defusedxml                    0.7.1
diff-match-patch              20241021
dill                          0.4.0
docstring-to-markdown         0.17
docutils                      0.21.2
executing                     2.2.0
ezdxf                         1.4.1
fastjsonschema                2.21.1
flake8                        7.1.2
fonttools                     4.58.0
idna                          3.10
imagesize                     1.4.1
importlib_metadata            8.7.0
inflection                    0.5.1
intervaltree                  3.1.0
ipykernel                     6.29.5
ipython                       8.36.0
isort                         6.0.1
jaraco.classes                3.4.0
jaraco.context                6.0.1
jaraco.functools              4.1.0
jedi                          0.19.2
jellyfish                     1.2.0
Jinja2                        3.1.6
jsonschema                    4.23.0
jsonschema-specifications     2025.4.1
jupyter_client                8.6.3
jupyter_core                  5.7.2
jupyterlab_pygments           0.3.0
keyring                       25.6.0
Logbook                       1.8.1
markdown-it-py                3.0.0
MarkupSafe                    3.0.2
matplotlib-inline             0.1.7
mccabe                        0.7.0
mdurl                         0.1.2
mistune                       3.1.3
more-itertools                10.7.0
multimethod                   1.12
mypy_extensions               1.1.0
nbclient                      0.10.2
nbconvert                     7.16.6
nbformat                      5.10.4
nest-asyncio                  1.6.0
nlopt                         2.9.1
numpy                         2.2.5
numpydoc                      1.8.0
packaging                     25.0
pandocfilters                 1.5.1
paramiko                      3.5.1
parso                         0.8.4
path                          17.1.0
pathspec                      0.12.1
pexpect                       4.9.0
pickleshare                   0.7.5
pip                           25.1.1
platformdirs                  4.3.8
pluggy                        1.5.0
prompt_toolkit                3.0.51
psutil                        7.0.0
ptyprocess                    0.7.0
pure_eval                     0.2.3
pycodestyle                   2.12.1
pycparser                     2.22
pydocstyle                    6.3.0
pyflakes                      3.2.0
Pygments                      2.19.1
pylint                        3.3.7
pylint-venv                   3.0.4
pyls-spyder                   0.4.0
PyNaCl                        1.5.0
pyparsing                     3.2.3
PyQt5                         5.15.11
PyQt5-Qt5                     5.15.2
PyQt5_sip                     12.17.0
pyqtgraph                     0.13.7
PyQtWebEngine                 5.15.7
PyQtWebEngine-Qt5             5.15.2
python-dateutil               2.9.0.post0
python-lsp-black              2.0.0
python-lsp-jsonrpc            1.1.2
python-lsp-server             1.12.2
python-slugify                8.0.4
pytoolconfig                  1.3.1
pywin32                       310
pywin32-ctypes                0.2.3
PyYAML                        6.0.2
pyzmq                         26.4.0
QDarkStyle                    3.2.3
qstylizer                     0.2.4
QtAwesome                     1.3.1
qtconsole                     5.5.2
QtPy                          2.4.3
referencing                   0.36.2
requests                      2.32.3
rich                          14.0.0
roman-numerals-py             3.1.0
rope                          1.13.0
rpds-py                       0.24.0
rtree                         1.4.0
setuptools                    80.4.0
six                           1.17.0
snowballstemmer               3.0.1
sortedcontainers              2.4.0
soupsieve                     2.7
Sphinx                        8.2.3
sphinxcontrib-applehelp       2.0.0
sphinxcontrib-devhelp         2.0.0
sphinxcontrib-htmlhelp        2.1.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          2.0.0
sphinxcontrib-serializinghtml 2.0.0
spyder                        5.5.6
spyder-kernels                2.5.2
stack-data                    0.6.3
tabulate                      0.9.0
text-unidecode                1.3
textdistance                  4.6.3
three-merge                   0.1.1
tinycss2                      1.4.0
tomlkit                       0.13.2
tornado                       6.4.2
traitlets                     5.14.3
types-python-dateutil         2.9.0.20241206
typing_extensions             4.13.2
typish                        1.9.3
ujson                         5.10.0
urllib3                       2.4.0
watchdog                      6.0.0
wcwidth                       0.2.13
webencodings                  0.5.1
whatthepatch                  1.0.7
yapf                          0.43.0
zipp                          3.21.0

どひゃ~

 

CadQuery(CQ-editor)アンインストール

アンインストールしたい場合は、pipのコマンドで行います。

pip uninstall CQ-editor

しかし、依存関係でインストールされた大量のパッケージはアンインストールされないため、

pip freeze > installed_packages.txt
pip uninstall -y -r installed_packages.txt

などとして一括削除をすると良いでしょう。

仮想環境下であれば環境を削除すれば良いだけではあります。

Python自体も使用しない場合は、wingetコマンドでPythonのアンインストールも行いましょう。

 

CadQuery(CQ-editor)の起動方法

グローバルインストール時に以下のパスにexeファイルが生成されます。

C:\Program Files\Python312\Scripts\CQ-editor.exe

仮想環境等でユーザーインストールを行った場合は AppData\Roaming\Python 以下に入ると思います。

exeファイルに対してショートカットを作成すれば起動しやすいでしょう。

 

別の起動方法としてはターミナルから

python -m cq_editor

としても起動できますし、以下の内容でショートカットを作成することもできます。

"C:\Program Files\Python312\python.exe" -m cq_editor

 

コンソール画面を出したくない

pythonw -m cq_editor

pythonwで出来ると思ったのですが起動しない?

pyinstaller.specファイルを見ると console=True にて作成されているようです。

start /B "" "C:\Program Files\Python312\Scripts\CQ-editor.exe" > nul 2>&1

ターミナルでstartコマンドを使用してバックグラウンドにしてしまえばGUIだけ出せそうではあります。

 

CQ-editor 起動後はチュートリアルへ

以下の記事をどうぞ