Tag Archives: IDE

[Solved] Homebrew Error: xcrun: error: invalid active developer path

Recently, I found an error when installing things with homebrew. It turned out that homebrew was not adapted after my Mac updated maxos big sur11. In addition, the Xcode tool was deleted before, resulting in the following error:

Input directly at the terminal and xcrun will be installed

xcode-select --install

It can be used directly after installation

[Solved] Mac homebrew error: Error: homebrew-core is a shallow clone.

Mac command line execution:

brew update 

The following error is reported:

Error: 
  homebrew-core is a shallow clone.
To `brew update`, first run:
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
This command may take a few minutes to run due to the large size of the repository.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!

The cause of this problem is usually the problem caused by the system update.

Solution: delete the homebrew core and then update it

cd /usr/local/Homebrew/Library/Taps/homebrew
rm -rf homebrew-core
brew upgrade

jupyter notebook Use pyLDAvis Error: AttributeError: module ‘pyLDAvis‘ has no attribute ‘gensim

Preparation
First, make sure you have the pyldavis and gensim libraries installed.

pip install gensim
pip install pyldavis

Code change
Secondly, if the error not attribute is because the version of pyldavis is different, the new version needs to be changed as follows: change all pyLDAvis.gensim to gensimvis。

import pyLDAvis.gensim as gensimvis
pyLDAvis.enable_notebook()
vis_sub_10 = gensimvis.prepare(lda_fst, corpus, dic, sort_topics = False)
vis_sub_20 = gensimvis.prepare(lda_snd, corpus, dic, sort_topics = False)
pyLDAvis.display(vis_sub_10)

Success! The effect is shown in the following figure.

Or you can install a lower version of pyldavis

pip install pyLDAvis==2.1.2

Codes:

import pyLDAvis.gensim
pyLDAvis.enable_notebook()
vis_sub_10 = pyLDAvis.gensimda_fst, corpus, dic, sort_topics = False)
vis_sub_20 = pyLDAvis.gensim.prepare(lda_snd, corpus, dic, sort_topics = False)
pyLDAvis.display(vis_sub_10)

How to Solve Pycharm SQL Union Error

Question

Today, when writing MySQL code in pycharm, I always encounter errors when using Union. Although the syntax itself is correct, the red horizontal line is annoying

It’s just that you have to change union to union all to eliminate the error report.

Press setting -> editor-> Inspections, then find no data sources configured under the SQL on the right, and cancel all related to the red exclamation mark, but it is still fruitless.

However, inspired by the article, the reason for the problem is found in the location of the configuration database

Solution:

The configuration database is in file -> Settings -> Languages & Frameworks -> SQL conversations
the reason for the problem is that I configured the database before. At that time, Clickhouse was configured, which is different from MySQL in the usage of union,
so just change Clickhouse to MySQL.

before change

modified

This will return to normal~

[How to Solve] Reason: Incompatible library version

Today’s respondent reported the following errors when testing the PIL package in Python:

Reason: Incompatible library version: _imaging.cpython-37m-darwin.so requires version 14.0.0 or later, but libjpeg.9.dylib provides version 12.0.0

By analyzing the error message, we can see that it is caused by the version incompatibility between libraries, because the PIL library is old and only supports python2.7, which may lead to this problem. So we think about how to solve it.

Solution

First, consider reloading the library. The basic environment of this environment is Python 3.7. Therefore, enter the code on the command line, delete the library first, and then reinstall it.

conda uninstall pillow
conda install pillow

Finally, the test re imports the library successfully and outputs the size of the picture

Successfully solve the problem!

How to Solve M1 chip import numpy Error

Error report of M1 chip import numpy

Environmental installation method:

miniforge – python3. 9 numpy 1.21.1

Operation error:

## terminal/pycharm error
import numpy
import pandas 

Error Messages:
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:

https://numpy.org/devdocs/user/troubleshooting-importerror.html

At the same time, the python version and numpy version are given, and many files in the miniforge folder no such file are mentioned repeatedly

Solution:

conda install openblas

Import again works normally

vscode git error: would clobber existing tag [How to Solve]

Using vscode’s own git interface to operate pull, there may be an error about the tag would clobber existing tag, resulting in the inability to pull

Solution:

1. Type git pull directly in terminal to finish pulling the code. Although the code is pulled, the vscode git tool still does not work.
2. Type git fetch –tags -f in terminal to force the local code tag to be updated first. Then use vscode’s git tools to pull the code.

[Solved] Eclipse Error: A JNI error has occurred, please check your installation and try again

Solution:

① Check whether the package name contains “Java” and modify it. Java should be avoided when creating the package.

② Run the Java version and javac version commands in CMD to check their own JDK and JRE versions. If they are different, reconfigure the environment variables to make them consistent

The above two steps can solve most of the problems. If they are still not solved, it is recommended to reinstall the JDK and reconfigure the environment variables.

VSCode Unable to find custom header file directory: fatal error: no such file or directory

The solution is as follows:

First, add the path of the folder where your header file is located in "includepath":[] of C_cpp_properties.json.

Of course, this step is only to tell the vscode header file where it is for debugging, but it is not known when GCC compiles. We know that if you use G + + main.CPP - I library_path - O main can be compiled successfully directly, so we just need to tell vscode to use our own defined commands

There are generally two methods. The first is to add “- I header_file_path” to the args key in tasks.json, as follows:

	"args": [
		"-g",
		"${workspaceFolder}\\src\\*.cpp",
		"-o",
		"${fileDirname}\\src\\${fileBasenameNoExtension}.exe",
		"-I",
		"header_file_path"
	],

But it doesn’t seem to work well in some cases.

The second method is to directly set in setting.json:

  "code-runner.executorMap": {
    "cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt -I 'header_file_path' && $dir$fileNameWithoutExt",
  }

[Solved] Latex&VScode Error: I found no bibdata command//command//citation—while reading file*.aux

Latex& Vscode error I found no bibdata command// command// citation – while reading file * aux

 

Problem description

The template I use requires the compile order: Compile with: xelatex -> biber -> xelatex -> xelatex

Using various tutorials in the VScode plugin configuration json file are xelatex -> bibtex -> xelatex -> xelatex

In fact bibtex and biber are not a thing, refer to tex link

Resulting in the problem as shown

Solution:

Add the configuration for biber compilation to the setting.json configuration file in VScode’s Latex

 "latex-workshop.latex.tools": [
      
        {
            "name": "biber",
            "command": "biber",
            "args": [
                "%DOC%"
              
            ]
        }
    ],
 "latex-workshop.latex.recipes": [
     {
         "name": "xelatex -> biber -> xelatex*2",
         "tools": [
         "xelatex",
         "biber",
         "xelatex",
         "xelatex"
         ]

     }
 ],

Restart VScode and use xelatex -> biber -> xelatex*2 to compile successfully

Full Codes:

{
    "latex-workshop.latex.tools": [
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "%DOC%"
            ]
        },
        {
            "name": "xelatex",
            "command": "xelatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ]
        },
        {
            "name": "pdflatex",
            "command": "pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ]
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            // "command": "biber",
            "args": [
                // "%DOC%"
                "%DOCFILE%"
            ]
        },
        {
            "name": "biber",
            "command": "biber",
            // "command": "biber",
            "args": [
                "%DOC%"
              
            ]
        }
    ],
    "latex-workshop.latex.recipes": [
        {
            "name": "xelatex",
            "tools": ["xelatex"]
        },
        {
            "name": "latexmk",
            "tools": ["latexmk"]
        },
        {
            "name": "pdflatex -> bibtex",
            "tools": ["pdflatex","bibtex"]
        },
        // {
        //     "name": "pdflatex -> bibtex -> pdflatex*2",
        //     "tools": [
        //         "pdflatex",
        //         "bibtex",
        //         "pdflatex",
        //         "pdflatex"
        //     ]
        // },
        {
            "name": "xelatex -> bibtex -> xelatex*2",
            "tools": [
            "xelatex",
            "bibtex",
            "xelatex",
            "xelatex"
            ]

        },
        {
            "name": "xelatex -> biber -> xelatex*2",
            "tools": [
            "xelatex",
            "biber",
            "xelatex",
            "xelatex"
            ]

        }
    ],
    "latex-workshop.latex.clean.fileTypes": [
        "*.aux",
        "*.bbl",
        "*.blg",
        "*.idx",
        "*.ind",
        "*.lof",
        "*.lot",
        "*.out",
        "*.toc",
        "*.acn",
        "*.acr",
        "*.alg",
        "*.glg",
        "*.glo",
        "*.gls",
        "*.ist",
        "*.fls",
        "*.log",
        "*.fdb_latexmk"
    ],
    "latex-workshop.message.error.show": false,
    "latex-workshop.message.warning.show": false,

    "latex-workshop.showContextMenu": true, 
    "latex-workshop.intellisense.package.enabled": true, 
    "latex-workshop.latex.autoBuild.run": "onSave", 

}