- 投稿日:2022-02-14T21:57:55+09:00
MMCVのインストール時エラー(MacOSX)
はじめに mmcvのリポジトリをcloneして、いざインストールしようとすると、Cmathのエラーが大量に出る人向け。 インストール手順 手順としては下記の通り。これを実行すると、cmath関係のエラーが出まくる。 git clone https://github.com/open-mmlab/mmdetection.git cd mmdetection pip install -r requirements/build.txt CC=clang CXX=clang++ CFLAGS='-stdlib=libc++' MMCV_WITH_OPS=1 pip install -e . 対策1 xcode-selectの再インストール。 実行後、シェルを再起動したほうが良い。 $ sudo rm -rf /Library/Developer/CommandLineTools $ xcode-select --install 対策2 対策1だけでダメな場合は、下記も試すと良いかも。 デフォルトのsdkの検索先を変更する。 まずは現状のsdkのパスを書きコマンドで確認する。 $ xcrun --show-sdk-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk これをCommandLineToolのほうに切り替える。 $ sudo xcode-select -s /Library/Developer/CommandLineTools $ xcrun --show-sdk-path /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk 結果 $ CC=clang CXX=clang++ CFLAGS='-stdlib=libc++' MMCV_WITH_OPS=1 pip install -e . Obtaining file:///Users/ookay/WorkDocs/workspace/project/2022_Nissan/nissan_object_detection/swin-transformer/mmcv Preparing metadata (setup.py) ... done ... Successfully installed addict-2.4.0 mmcv-full-1.4.5 pyyaml-6.0 yapf-0.32.0 インストールできた。 メモ ちなみにsdkの参照を元に戻すには下記のコマンドでOK。 $ sudo xcode-select --reset
- 投稿日:2022-02-14T19:52:47+09:00
Macのzshを改造する
Homebrewでzsh関連インストール terminal brew update brew install zsh brew install zsh-completions brew install zsh-autosuggestions brew install zsh-syntax-highlighting zshをデフォルトに設定 terminal chsh -s /bin/zsh .zshrcに以下追加 .zshrc path=(/path/to/homebrew/share/zsh-completions $fpath) autoload -U compinit compinit -u source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh ターミナルを開くたびに聞かれる。 zsh compinit: insecure directories, run compaudit for list. Ignore insecure directories and continue [y] or abort compinit [n]? 以下のコマンドで出てくるパスを出力する。 terminal compaudit 出力されたパスに対して権限変更する。 terminal chmod 755 /usr/local/share chmod 755 /usr/local/share/zsh chmod 755 /usr/local/share/zsh/site-functions 以上
- 投稿日:2022-02-14T14:52:07+09:00
M1Mac + Pyenv + Pyenv-Virtualenvでの'pyenv install'時エラー
前提 Mac M1Max Pyenv + Virtualenvを利用していて、ある日pyenv installができなくなった エラー内容 pyenvで新しいPythonをインストールしようとすると、下記のようなエラーが出る。 アーキテクチャ絡み?M1のせい? $ pyenv install 3.7.12 Last 10 log lines: "_libintl_textdomain", referenced from: _PyIntl_textdomain in libpython3.7m.a(_localemodule.o) _PyIntl_textdomain in libpython3.7m.a(_localemodule.o) ld: symbol(s) not found for architecture x86_64 ld: symbol(s) not found for architecture x86_64 clang: clangerror: : linker command failed with exit code 1 (use -v to see invocation)error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Programs/_testembed] Error 1 make: *** Waiting for unfinished jobs.... make: *** [python.exe] Error 1 対処法 いろいろなサイトに転がっていた、下記対処法が効きそう。 必要ないものもあるかも。誰か教えてください。 binutilsのアンインストール そもそも私の環境では入っていなかった。 $ brew uninstall binutils Error: No such keg: /opt/homebrew/Cellar/binutils XcodeのCommand Line Toolsの設定 xcodeを起動 Preferenceをクリック Locationsタブを選択 Command Line Toolsが選択されていない場合は、選択する Pyenvの再インストール 上だけでは治らなかったので、再インストール。キャッシュの削除などは不要。 brew uninstall pyenv-virtualenv brew uninstall pyenv brew install pyenv brew install pyenv-virtualenv 実行 $ pyenv install 3.7.12 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Installing Python-3.7.12... python-build: use readline from homebrew python-build: use zlib from xcode sdk Installed Python-3.7.12 to /Users/<USER NAME>/.pyenv/versions/3.7.12 動いた!
- 投稿日:2022-02-14T11:02:08+09:00
homebrew-cask の GPG Suite 一覧
ほどなくして古くなりそうなので、記事の鮮度が分かりやすい Qiita に。 GPG Suite GPG Suite One simple package with everything you need, to protect your emails and files. GitHub に GnuPG で署名しようとすると、最近は pinentry-mac を直接入れるよりこちらを入れるように書かれている。 ただ 2022/02 現在で homebrew-cask にこのパッケージは4つある gpg-suite gpg-suite-nightly (現在消滅?) gpg-suite-no-mail gpg-suite-pinentry この違いをCaskfileから見てみる gpg-suite pkg "Install.pkg" パッケージインストール時にオプション選択肢の指定がない。 なので、GPG Mailなどが一通り入る。 gpg-suite-no-mail pkg "Install.pkg", choices: [ { "choiceIdentifier" => "installer_choice_1", # preinstall.pkg "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "installer_choice_2", # Libmacgpg_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "installer_choice_3", # LibmacgpgXPC_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "installer_choice_4", # GPGMail_6_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_5", # GPGMail_5_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_6", # GPGMail_4_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_7", # GGPGMail_3_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_8", # GPGMail_12_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_9", # GPGMailLoader_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_10", # GPGServices_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "installer_choice_11", # GPGKeychain_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "installer_choice_12", # GPGPreferences_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "installer_choice_13", # MacGPG2.1_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "installer_choice_14", # Updater_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "installer_choice_15", # pinentry_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "installer_choice_16", # version.pkg "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "installer_choice_17", # key.pkg "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "installer_choice_18", # CheckPrivateKey.pkg "choiceAttribute" => "selected", "attributeSetting" => 1, }, ] パッケージインストール時に GPG Mail 関係のオプション選択肢が 0 に指定されていて、それ以外は 1 になっている。 なので、以下は入る。 libmacgpg MacGPG2 GPGServices GPGKeychain GPGPreferences pinentry よって /usr/local/MacGPG2/bin/gpg2 が入るので別途 gnupg を導入する必要はない。 gpg-suite-pinentry pkg "Install.pkg", choices: [ { "choiceIdentifier" => "installer_choice_1", # preinstall.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_2", # Libmacgpg_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_3", # LibmacgpgXPC_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_4", # GPGMail_6_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_5", # GPGMail_5_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_6", # GPGMail_4_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_7", # GGPGMail_3_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_8", # GPGMail_12_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_9", # GPGMailLoader_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_10", # GPGServices_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_11", # GPGKeychain_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_12", # GPGPreferences_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_13", # MacGPG2.1_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_14", # Updater_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_15", # pinentry_Core.pkg "choiceAttribute" => "selected", "attributeSetting" => 1, }, { "choiceIdentifier" => "installer_choice_16", # version.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_17", # key.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, { "choiceIdentifier" => "installer_choice_18", # CheckPrivateKey.pkg "choiceAttribute" => "selected", "attributeSetting" => 0, }, ] pinentry しか選択されていない。 なので Keychain や System Preference に統合はされない(はず)。 pinentry しか使わない、OS統合部分に興味はないし他にGPG署名使わない、というなら gpg-suite-pinentry で問題ない。 もちろん、この場合 MacGPG2 が入っていないので別途 gnupg なりを導入する必要がある。 既に gnupg を導入している場合、 MacGPG2 が持つ /usr/local/MacGPG2/bin/gpg2 が存在しないので複数バージョンの gpg2 が存在する状況を回避できる。 結局どれ? GPG Mail を使うなら gpg-suite Mailには使わないけどMacらしく使うなら gpg-suite-no-mail 別途 gnupg などを使うコマンドラインオンリー派は gpg-suite-pinentry あたりだろうか。
- 投稿日:2022-02-14T10:16:06+09:00
Docker Desktopの代替品使ってみた (Mac)
3年ぶりくらいにContainerの世界に戻ってきたら、いつの間にかDocker Desktopが商用だとfreeで使えなくね?ってなったので、代替品を探していたら、Rancher Desktopを発見しました。 で早速、乗り換えのために試して、エラーにハマったための備忘録がわりの記事となります。 インストール環境 MacBook Pro (13-inch, M1, 2020)、macOS Monterey 12.1 チップ : Apple M1 メモリ : 16 GB インストール作業 すでにインストール済みのDocker Desktopを削除 公式サイトから、dmgファイルをダウンロードして実行。 インストール時には、Moby(dockerd)を指定。 ハマった部分① 立ち上がった、Rancher Desktopの設定内容を確認中、下記のエラーを見つけました。 FAQのページを参照していると、下記の記述がありました。 Q: The tools on the Support Utilities page are not installed and I see a Insufficient permission to manipulate /usr/local/bin error, how do I fix it? A: This occurs when you do not have ownership of /usr/local/bin. A long-term solution to improve the handling of permissions is in the works. In the meantime, a temporary workaround is to change ownership of /usr/local/bin by running sudo chown $USER /usr/local/bin. When you are able to write to the directory, Rancher Desktop is able to create the symlinks. というわけで、テンポラリーのワークアラウンドとして、コマンド実行して権限をちょっと変更することでエラーが解消されます。 ハマった部分② コンソールからdockerを実行してみても見つからない。 % which docker docker not found /usr/local/binの内容を確認していると、どうやら、まだDocker Desktopの内容を参照しているようだったので、/usr/local/bin内の不要な(Docker.Appsを参照している)コマンドたちを削除。 確かに、上のPermissionエラーの画面でも、 Already linked to /Application/Docker.app/Contents/Resources/bin/docker とか書いてるから、不要なものが残っているみたいです。 その後、Rancher Desktopから、シンボリックリンクを作成するようにチェックしていくことでエラーが解消。 上記画像のコマンドについてシンボリックリンクを作成するので、docker-composeなどは存在しない。 動作確認 とりあえず、hello-worldで動作確認。 % docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 93288797bd35: Pull complete Digest: sha256:507ecde44b8eb741278274653120c2bf793b174c06ff4eaa672b713b3263477b Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (arm64v8) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/ さて、少しずつリハビリしていこう。
- 投稿日:2022-02-14T09:11:22+09:00
Minecraftのserver起動のCommand入力を出来るだけ楽にしたい
こんにちは。里芋のすり身です。 突然ではありますが、 「Minecraft」(以下マイクラと表記)というゲームは好きですか? みんな好きだと思ってます。 ただ、マイクラサーバーをCommandで入力するとき、 $ ~~~ % cd ~~~/~~~/~~~/~~~/Minecraft/サーバー用ファイル $ ~~~ % java -Xmx~G -Xms~G -jar server.jar nogui のような、Command入力していませんか? これ、正直面倒ですよね。そこで、楽にしてみたいと思って、ちょこっとプログラミングを書いてみました。よければ見ていってください。 Minecraftの事前準備 Minecraftのインストールはお済みでしょうか?この記事はマインクラフトサーバーを自分で立てようと思ってない方以外は役に立てないと思うので、その点ご留意を。 本当に簡単なサーバーの立て方の説明 Minecraftからダウンロードしたserver.jarを[Application Support/Minecraft/サーバー用ファイル]の中に突っ込んでjarファイルを解凍。その後server.jarをクリック。Command入力の場合は、 $ ~~~ % cd ~~~/~~~/~~~/~~~/Minecraft/サーバー用ファイル $ ~~~ % java -Xmx~G -Xms~G -jar server.jar nogui で、起動します。(~は任意の数) cd-->java ~ が面倒で仕方がない これすら面倒になりました。そこで勝手に起動してくれるようにできないかなぁと思った時に、 pythonの $ ~~~ % pyinstaller mine_driver.py --onefile で、windowで言えばexe化、macで言えば起動アプリ化できることが閃きまして、pythonでterminalを操作できれば起動アプリが作れるぞ!と思い、ちょこっと書いてみました。 Commandを動かす上での注意 これは、server.jarが[Application Support/Minecraft/サーバー用ファイル]に入っていることが前提です。あと、これはターミナルを移動するコマンドを書いているだけなので、実際に動かしているのはterminal操作であってjavaをpythonで起動させている訳ではないです。初心者Commandなので、その点ご留意を #================================================# #Pythonとserver.jarを組み合わせた楽々起動マン #作成日:2022/02/13 #製作者:里芋のすり身 #================================================# import subprocess import os import sys #================================================# #1.PATHの取得から、Minecraftのファイルまでの自動移動 #================================================# path = os.getcwd() # PATHの取得 print('現在のPATHは ' + path + ' です。') #そのpathを出力 def change_file(): while True: choice = input("Minecraftファイルまで移動します。よろしいですか?[y/N]").lower() if choice in ['y', 'ye', 'yes']: return True elif choice in ['n', 'no']: return False if __name__ == '__main__': if change_file(): os.chdir('/Users/~~~~~~/~~~~~~~/Application Support/Minecraft/~~~~~~~~~~') #change directly path = os.getcwd() #PATHの更新 print('現在のPATHは ' + path + ' です。') else: print('変更しませんでした。') path = os.getcwd() #更新などないが、一応更新 print('現在のPATHは ' + path + ' です。') sys.exit() #================================================# #2.実際に移動したファイルでサーバーを起動 #================================================# def running_minecraft(): while True: choice = input("Minecraftを起動します。よろしいですか?[y/N]").lower() if choice in ['y', 'ye', 'yes']: return True elif choice in ['n', 'no']: return False if __name__ == '__main__': if running_minecraft(): try: subprocess.run("java -Xmx4G -Xms1G -jar server.jar nogui",shell = True) except: print ('ERROR') else: print('起動しませんでした。') こんな感じにしました。他の人のプログラミングを少し参考にさせてもらってます。 python内の os.chdir('/Users/~~~~~~/~~~~~~~/Application Support/Minecraft/~~~~~~~~~~') #change directly の部分がもしMinecraftファイルの中にserver専用ファイルを用いてた場合はこの~~~~の部分はそのファイル名にしてください。一回設定してしまえば、後で場所を動かさなければ書き換える必要がないので。 最後に起動ファイル化 あとは $ ~~~ % pyinstaller mine_driver.py --onefile で、はい!出来上がりです。 これで、起動も確認できると思います。わからなかったら質問待ってます。 初心者コマンドなので、どうか非難とかは怖いです。やめてほしいです。 それでは、ここまで読んで頂いて、ありがとうございました。
- 投稿日:2022-02-14T09:02:31+09:00
Windows側からVisualStudioでMacにペアリングすると、「Xcodeが見つからない」と出る
WindowsのVisualStudioで、Macにペアリングできない! 何度か試したのですが、 Windows機側から、Macにペアリングしようとすると、 「Xcodeが既定の場所に見つかりません」的なメッセージが。 調べた。。 デフォルト、「/Application/XCode」にあるのに、 なぜか、Mac側の環境変数で、そこじゃないところに、AppleSDKはあるといっているのが原因の様子。 事前にMac側にインストールしていた、 VisualStudio for Macを開いて、 以下の手順をしたら、無事接続できたので、備忘録! 手順 Mac側で、任意のVisualStudioを開く(任意のプロジェクト作ってないと駄目かも) [Visual Studio] > [ユーザー設定]を開く メニューから、[プロジェクト] > [SDKの場所] > [Apple]を選択 [Apple SDK]の項がエラーになっていれば、[参照(B)...]をクリックして、「/Application/XCode」を選択 この後、Windows側のVisualStudioから、Macとペアリングすると・・・ うまくいった~!!!! このあたり、説明がしっかり書かれていないので、ぜひぜひ皆様ご確認してみてください。 See you next!