Tag Archives: mac

ERROR Docker Engine API on Mac Osx

    according to the official document docker desktop on MAC vs. docker toolbox, docker desktop on Mac only provides UNIX socket/var/run/docker.socket, and does not provide TCP listening (default 2375 port). If you configure host in docker desktop using the configuration method of Linux, Docker desktop cannot be started. You need to delete the hosts configuration in ~ /. Docker/daemon.json to start normally. The following method exposes 2375 TCP

    docker run --rm -d -v /var/run/docker.sock:/var/run/docker.sock -p 127.0.0.1:2375:2375 bobrik/socat TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock
    
      then view the current docker engine version through docker version, such as 1.40. View the official engine API document: https://docs.docker.com/engine/api Search for an image to test:

      $curl -XGET http://127.0.0.1:2375/version | python -mjson.tool
      
      {
          "ApiVersion": "1.41",
          "Arch": "amd64",
          "BuildTime": "2021-07-30T19:52:10.000000000+00:00",
          "Components": [
              {
                  "Details": {
                      "ApiVersion": "1.41",
                      "Arch": "amd64",
                      "BuildTime": "2021-07-30T19:52:10.000000000+00:00",
                      "Experimental": "false",
                      "GitCommit": "75249d8",
                      "GoVersion": "go1.16.6",
                      "KernelVersion": "5.10.47-linuxkit",
                      "MinAPIVersion": "1.12",
                      "Os": "linux"
                  },
                  "Name": "Engine",
                  "Version": "20.10.8"
              },
              {
                  "Details": {
                      "GitCommit": "e25210fe30a0a703442421b0f60afac609f950a3"
                  },
                  "Name": "containerd",
                  "Version": "1.4.9"
              },
              {
                  "Details": {
                      "GitCommit": "v1.0.1-0-g4144b63"
                  },
                  "Name": "runc",
                  "Version": "1.0.1"
              },
              {
                  "Details": {
                      "GitCommit": "de40ad0"
                  },
                  "Name": "docker-init",
                  "Version": "0.19.0"
              }
          ],
          "GitCommit": "75249d8",
          "GoVersion": "go1.16.6",
          "KernelVersion": "5.10.47-linuxkit",
          "MinAPIVersion": "1.12",
          "Os": "linux",
          "Platform": {
              "Name": "Docker Engine - Community"
          },
          "Version": "20.10.8"
      }
      

Mac Error: sh: vue-cli-service: command not found

# Clear buffer NPM cache clean — force

#Reinstall NPM/cnpm install

Another online article, roughly said three solutions

1. Reinstall the
Folder node_ Modules are deleted and reinstalled by executing NPM/cnpm install

2. Specify path

./node_ modules/.bin/vue-cli-service build

3. Global installation

npm install @vue/cli-service -g

4. Environment variable node_ ENV=production

Try a few more times. You can refer to it for other reasons https://stackoverflow.com/questions/51172064/command-not-found-with-vue-cli

Error: EACCES: permission denied, unlink ‘xxxx/xxxx/xxxx‘ [How to Solve]

Scenario: on the Mac, if you want to use the code command to open vs code, (CMD + Shift + P) search the shell, find this:

Results Click to find:

	Error: EACCES: permission denied, 
	unlink '/usr/local/bin/code'

In fact, I don’t have read-write permission, and it’s ineffective to search a lot on the Internet. However, I’m used to using the command line to open vs code. The final solution is:

Enter at the command line

sudo chown -R [yourusername] [filePath]

Yourusername: user preferences – & gt; Users and groups – & gt; Current user
filepath: the path displayed when an error is reported

Tips: if not, try to move the path forward. Take me as an example:

sudo chown -R xxx /usr/local/bin

[Solved] Error: [email protected]: wrong number of arguments (given 1, expected 0)

First, let’s talk about the problems I encountered. Brew install & lt; formula> Error reporting:

(venv_mac)  haypin@HaypinsMBP  /usr/local/Cellar  brew install cmake
Error: [email protected]: wrong number of arguments (given 1, expected 0)

Even if I quit the previous virtual environment, I opened the debugging information and found:

(venv_mac)  ✘ haypin@HaypinsMBP  /usr/local/Cellar  brew install --debug cmake
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/sphinx-doc.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/[email protected]
Error: [email protected]: wrong number of arguments (given 1, expected 0)

Executable/usr/local/homebrew/library/homebrew/brew.rb (formulary:: formulaloader): always loading/usr/local/homebrew/library/taps/homebrew/homebrew core/formula/ [email protected] , which reports an error Python 3.9 parameter transfer error.

It is said on the Internet that brew install cmake can solve the problem, but I still report this error on the premise that cmake has been installed. There is no way but to reinstall homebrew and hope for a new homebrew core/ [email protected] It can be executed normally

(venv_mac)  ✘ haypin@HaypinsMBP  /usr/local/Cellar  /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Warning: The Ruby Homebrew uninstaller is now deprecated and has been rewritten in
Bash. Please migrate to the following command:
  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

^C

It is found that the script for uninstalling homebrew has expired. It is recommended to use:

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh )”

Then use this:

(venv_mac)  ✘ haypin@HaypinsMBP  /usr/local/Cellar  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
Warning: This script will remove:
/Users/haypin/Library/Caches/Homebrew/
/Users/haypin/Library/Logs/Homebrew/
/usr/local/Caskroom/
/usr/local/Cellar/
/usr/local/bin/brew -> /usr/local/bin/brew
Are you sure you want to uninstall Homebrew?This will remove your installed packages! [y/N] y
==> Removing Homebrew installation...
Warning: Failed to delete /usr/local/Caskroom
rm: /usr/local/Caskroom: Permission denied
Warning: Failed to delete /usr/local/Cellar
rm: /usr/local/Cellar: Permission denied
==> Removing empty directories...
==> /usr/bin/sudo /usr/bin/find /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/var /usr/local/Caskroom /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks -name .DS_Store -delete
==> /usr/bin/sudo /usr/bin/find /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/var /usr/local/Caskroom /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks -depth -type d -empty -exec rmdir {} ;
==> Homebrew uninstalled!
The following possible Homebrew files were not deleted:
/usr/local/.com.apple.installer.keep
/usr/local/Frameworks/
/usr/local/Homebrew/
/usr/local/bin/
/usr/local/etc/
/usr/local/go/
/usr/local/include/
/usr/local/lib/
/usr/local/mysql -> /usr/local/mysql
/usr/local/mysql-8.0.21-macos10.15-x86_64/
/usr/local/opt/
/usr/local/sbin/
/usr/local/share/
/usr/local/var/
You may wish to remove them yourself.

I didn’t use sudo, so/usr/local/cashroom and/usr/local/cell were not deleted. I forgot that CWD was in/usr/local/cell. Finally, I prompted that a possible homebrw file had not been deleted, so I deleted it manually:

(venv_mac)  ✘ haypin@HaypinsMBP  /usr/local  sudo rm -r Homebrew

Then reinstall homebrew according to the latest installation script on the official website:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

This is the installation script of the official website. It uses foreign sources. The download speed is very slow and may fail. Just execute it a few more times. The domestic sources are very unfriendly when upgrading brew later. The error I reported in Python 3.9 this time is homebrew 2.4.9. Even if brew update is still 2.4.9, it will not be upgraded to the latest 3.2.0, so although slow down, I still want to use foreign sources.

Zshrc reports an error after changing the Tsinghua source:

(venv_mac)  haypin@HaypinsMBP  ~/cmake_tutorial  source ~/.zshrc
compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew_cask

 

Then I found that the cmake official website has a DMG installation package that can be installed to/applications, so I downloaded and installed it from the cmake official website. If there is a need to upgrade later, I will directly the whole RM – R  / Applications/cmake.app and then download the latest cmake-3.21.0-macos-universal.dmg installation. Of course, add the path/applications/cmake.app/contents/bin/ to the path.

I was frightened by the mistake reported by the brew install cmake. In the future, the software that I can download from the official website will go to the official website.

Terminal appears after anconda is installed on MAC (base)

After MAC reinstalls anaconda, it is found that each time terminal is opened, anconda’s environment is started by default. However, I don’t want to use anconda’s environment by default, as shown in the following figure.

The closing method is as follows

Method 1:

Every time you exit the base environment through CONDA deactivate on the command line, return to the automatic environment of the system

Method 2

1. By setting Auto_ activate_ Set the base parameter to false to implement:

conda config --set auto_activate_base false

2. If you want to enter, you can use CONDA activate base

3. If you go back and hope to keep it all the time, pass

conda config --set auto_activate_base true

recovery

How to solve the problem of “unable to open / dev / vmmon: broken pipeline” when running VMware virtual machine?

When using VMware fusion to install virtual machine system on MAC, sometimes it will prompt “can’t open/dev/vmmon: fracture pipeline”, which is caused by the system blocking some plug-ins of virtual machine

resolvent

Open system preferences – & gt【 Security and privacy] – & gt【 General], there will be a prompt that the plug-in will block. Click allow; Or modify the system security settings to any source

[Solved] Error: Failure while executing; `tar –extract –no-same-owner –file /Users/wangchuangyan/Library/C

Mac run brew install npm error:
Error: Failure while executing; tar --extract --no-same-owner --file /Users/wangchuangyan/Library/Caches/Homebrew/downloads/01840f175b09e7eb3d4ca7f11492bb1bee74fa7569a41a884c7ffb3418e11a02--libuv-1.41.0.catalina.bottle.tar.gz --directory /private/tmp/d20210708-6134-w2f3oo exited with

1. Here’s the output:
tar: Error opening archive: Failed to open ‘/Users/wangchuangyan/Library/Caches/Homebrew/downloads/01840f175b09e7eb3d4ca7f11492bb1bee74fa7569a41a884c7ffb3418e11a02–libuv-1.41.0.catalina.bottle.tar.gz’
It means that the libuv file cannot be opened
Solution: manually install brew install libuv

How to Solve Cocoapods Installation Failure

The scene appears

Recently, I replaced a 512 large hard disk and re installed MacOS 10.15. When installing cocoapods, the following error occurred

Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20210324-1667-1wwdce5.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi... yes
checking for ffi_prep_closure_loc() in -lffi... yes
checking for ffi_prep_cif_var()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
creating extconf.h
creating Makefile

current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/ext/ffi_c
make "DESTDIR=" clean

current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/ext/ffi_c
make "DESTDIR="
make: *** No rule to make target `"/Volumes/macOS', needed by `AbstractMemory.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/ffi-1.15.0/gem_make.out

Solution:

    1. it may be the problem of system version, which is not compatible with the latest version, so install the old version directly. I encountered the problem is 2021.07.06, the latest version is 1.10.1, find a 1.9.32020.05 release, should be compatible with 10.15
# Specify version to install
sudo gem install -n /usr/local/bin cocoapods -v 1.9.3
      1. use brew to install
brew install cocoapods

About the problem of calling tools library by running Python program under Mac OS X, modulenotfoundererror: no module named ‘tools‘

ModuleNotFoundError: No module named ‘Tools’

For example, import the tools library into pcharm of MAC

from Tools.scripts.abitype import classify
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
from sklearn import datasets
from minisom import MiniSom

The first line will report error!!!

It seems that it is very difficult to change the tools variable in MAC environment. The solutions are as follows

Direct import classify

import classify

The test is effective ~