Tag Archives: bug

Keras-nightly Import package Error: cannot import name ‘Adam‘ from ‘keras.optimizers‘

Version keras nightly = 2.5.0.dev2021032900

Error information

    from keras.optimizers import Adam
ImportError: cannot import name 'Adam' from 'keras.optimizers' 


error code

from keras.optimizers import Adam
opt = Adam(lr=lr, decay=lr/epochs)


from keras.optimizers import adam_v2
opt = adam_v2.Adam(learning_rate=lr, decay=lr/epochs)


After the keras library is updated, the package cannot be imported in the original way. Open the optimizers.py source code and find the following two key codes. You can see that Adam import has changed, so it is modified as above.

from keras.optimizer_v2 import adam as adam_v2
'adam': adam_v2.Adam,

Solved: could not find the task ‘G + + build active file, leetcode algorithm ACM compilation and debugging

Project scenario:

Environment: Ubuntu 20.04

Tool: vscode

Because leetcode can’t debug the code (for members), it’s necessary to configure the local environment to run the code.

Leetcode’s code is to help you configure all the environments. You only need to write the core code, but you need to write all the code yourself during the interview. It’s ACM mode (Baidu ACM). At this time, if you don’t often write all the code, it’s easy to be confused (this is what happened when I was deeply convinced in the online interview)

So it’s necessary to configure the local environment and write the whole process of algorithm implementation, including the compilation process and principle of cpp file, and the debug process can make you more familiar with the code running process.

Reference for compiling environment configuration: https://code.visualstudio.com/docs/cpp/config-linux

No Baidu, no Baidu! Look at the official statement is always the best!!! If you don’t understand English, you can right-click to translate the web page directly.

My task.json configuration: it is automatically generated. The configuration of the computer and the environment is different, so this file may be different.

	"version": "2.0.0",
	"tasks": [
			"type": "cppbuild",
			"label": "C/C++: g++ Generate activity files",
			"command": "/usr/bin/g++",
			"args": ["-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}"],
			"options": {
				"cwd": "${fileDirname}"
			"problemMatcher": [
			"group": {
				"kind": "build",
				"isDefault": true
			"detail": "Compilers: /usr/bin/g++"

My launch.json:

    "version": "0.2.0",
    "configurations": [
        "name": "g++ build and debug active file",
        "type": "cppdbg",
        "request": "launch",
        "program": "${fileDirname}/${fileBasenameNoExtension}",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "setupCommands": [
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
        "preLaunchTask": "g++ build active file",
        "miDebuggerPath": "/usr/bin/gdb"

Problem Description.
I encountered the following situation when configuring task.json for compiling C++ and debugging configuration file launch.json.

Cause Analysis.
Code encountered problems suggest direct google …
Reference: https://stackoverflow.com/questions/59106732/visual-studio-code-debugger-error-could-not-find-the-task-gcc-build-active-f

In your task.json file, no task is labeled as ‘gcc build active file’ which is required as a preLaunchTask in launch.json file.

So you can either change the label of task or change the content of preLaunchTask to make them match.

The answer is clear: task.json file this configuration

"label": "C/C++: g++ Generate activity files",

This configuration must be the same as launch. JSON

"preLaunchTask": "g++ build active file",


Configure task.json as follows:

"label": "C/C++: g++ Generate activity files",

To be amended as follows:

"label": "g++ build active file",

—————————The following can be ignored———————————-

As long as the two values are the same. You can be like this: (yes, that’s what I changed it to.)

"label": "g++ build active file  hahaha",

[Solved] ERROR Failed to compile with 3 errors These dependencies were not found: * pdfjs-dist/es5/buil


Xiao Fang is a junior student. Today, he joined a front-end intern position in a company. He is so proud that he plans to do a big job. Results the card was stuck in NPM run build , and the error message was reported (as follows).

$ npm run build

> [email protected] build /usr/local/docker/gitlab-ee-12.4.1/builds/63s9Rzjq/0/dev_web/system
> vue-cli-service build --mode production

-  Building for production...
 ERROR  Failed to compile with 3 errors PM 3:24:46

These dependencies were not found:

* pdfjs-dist/es5/build/pdf.js in ./node_modules/[email protected]@cache-loader/dist/cjs.js??ref--12-0!./node_modules/[email protected]@thread-loader/dist/cjs.js!./node_modules/[email protected]@babel-loader/lib!./node_modules/[email protected]@cache-loader/dist/cjs.js??ref--0-0!./node_modules/[email protected]@vue-loader/lib??vue-loader-options!./node_modules/[email protected]@vue-pdf/src/vuePdfNoSss.vue?vue&type=script&lang=js&
* worker-loader!pdfjs-dist/es5/build/pdf.worker.js in ./node_modules/[email protected]@cache-loader/dist/cjs.js??ref--12-0!./node_modules/[email protected]@thread-loader/dist/cjs.js!./node_modules/[email protected]@babel-loader/lib!./node_modules/[email protected]@cache-loader/dist/cjs.js??ref--0-0!./node_modules/[email protected]@vue-loader/lib??vue-loader-options!./node_modules/[email protected]@vue-pdf/src/vuePdfNoSss.vue?vue&type=script&lang=js&
* pdfjs-dist/es5/web/pdf_viewer in ./node_modules/[email protected]@vue-pdf/src/pdfjsWrapper.js

To install them, you can run: npm install --save pdfjs-dist/es5/build/pdf.js worker-loader!pdfjs-dist/es5/build/pdf.worker.js pdfjs-dist/es5/web/pdf_viewer
 ERROR  Build failed with errors.
npm ERR! errno 1
npm ERR! [email protected] build: `vue-cli-service build --mode production`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-06-08T07_24_46_457Z-debug.log
ERROR: Job failed: exit status 1

What? Can’t even run the project, so you have to be dissuaded on the first day of employment?! Reluctantly, he spent a whole day searching Baidu and Google, but he didn’t find the problem

After the meeting in the afternoon, the leader passed by his work station and saw Xiao Fang, who was in a mess, asked if the environment had been set up. At this time, Xiao Fang was already suffering from this problem and fed it back to the leaders. Unexpectedly, the leader gently put down the water cup in his hand and did a careful investigation on Xiao Fang’s work position. The leader quickly located the node_ However, it seems that this problem is rather intractable, and it has not been solved after half an hour. In the end, the leader put the node in his computer_ Moudels is copied, and the problem is found after replacement

it can be seen vaguely that Xiaofang installed the 2.8.335 version of pdfjs dist, while the leader used 2.5.207 , and this newer version is not compatible with the node environment, resulting in an error.


The problem is that in the development team, the front-end project should not put the package lock. JSON file used to lock the version into gitignore, because the most critical factor of development is stability rather than the latest
hope to solve your problem, see you~

[Solved] Wwagger error: java.lang.NumberFormatException: For input string: ““

I have been reporting this error before, but I haven’t found out the reason. After looking at the code given by a senior, I found that the following two jar packages are missing, and then I won’t report any more errors.


After joining, click in again and you won’t report an error again.

FileNotFoundError: Could not find module ‘D:\Anaconda3\envs\labe\Library\bin\geos_c.dll‘ [Solved]

FileNotFoundError: Could not find module
‘D:\Anaconda3\envs\LabelImg\label\bin\geos_c.dll’ (or one of its dependencies).
Try using the full path with constructor syntax.(or one of its dependencies). Try using the full path with constructor syntax.

1, most people are not importing the “shapely” dependency. You only need to import it

pip install shapely

2. Import this or report an error, basically it is wrong with your Python version.

To download the corresponding. WHL file, the link is as follows: https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely , after entering the website, Ctrl + F can find shapely, and select the version up or down according to your own version( The author is python3.8)

#First uninstall the downloaded shapely
pip uninstall shapely
#then download the local cp38 version of shapely
pip install D:\PyCharm\Pro\OCR\PaddleOCR\PPOCRLabel\BACK\Shapely-1.7.1-cp38-cp38-win_amd64.whl

Successfully solved the problem of “runtimee” in RESNET dataset classification rror:expected scalar type Long but found Float”

Recently, I encountered some mistakes as shown in the title when doing deep learning classification, but I don’t know how to modify them. Finally, after exploration, I successfully solved them
the problems and solutions are reported directly below.



In practice, the label of classification should be long, and the image should be float32
therefore, modifying the data type will succeed, but it doesn’t matter. I’ll share it with you after I solve it successfully!

[Python] pip.vendor.urllib3.exceptions.readtimeouterror: httpsconnectionpool protocol

When installing a python module with pip or pychar, you sometimes encounter a readtimeout error. The reason for this problem is probably the network speed

my default source is Tsinghua, sometimes the link network is not good ( the day after the college entrance examination today, it is estimated that there are too many visitors, everyone wants to go to Tsinghua, ha ha ), so I change the source.

pip --default-timeout=100 install pyspark -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

Perfect solution

[Solved] Ubuntu pyinstaller Error when packaging executable file: … qt.qpa.plugin: Could not find the Qt platform plugin “xcb“ in “…

Ubuntu pyinstaller Error when packaging the executable: … qt.qpa.plugin: Could not find the Qt platform plugin “xcb” in “…
Solution to the problem

Ubuntu pyinstaller reports an error when packaging the executable: .QFactoryLoader::QFactoryLoader() checking directory path “/home/dyj/CarUI/dist/carmain/platforms” … qt.qpa.plugin: Could not find the Qt platform plugin “xcb” in “” This application failed to start because no Qt platform plugin could be initialized.
Add the following code to your own main program code.

import os
import PySide2
dirname = os.path.dirname(PySide2.__file__)
plugin_path = os.path.join(dirname, 'plugins', 'platforms')
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path

[How to Solve] Content with element type ‘mapper’ must match

Today, in the mapper. XML file, I mistakenly annotated it with /* * code description */ and then reported this error
the specific exception is as follows

Caused by: org.xml.sax.SAXParseException; lineNumber: 134; columnNumber: 10, The element type "mapper" must match "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。

error code 

   /** Public conditions */
    <sql id="commonIfWhere">
        <if test='params.projectId != null and params.projectId != ""'>
            and project_id = #{params.projectId}
        <if test='params.id!= null and params.id != ""'>
            and id = #{params.id}

after correction

   <!-- Public conditions -->
    <sql id="commonIfWhere">
        <if test='params.projectId != null and params.projectId != ""'>
            and project_id = #{params.projectId}
        <if test='params.id!= null and params.id != ""'>
            and id = #{params.id}

The problem was solved smoothly