Tag Archives: Exception handling

[Solved] Python AssertionError: MMCV==1.1.0 is used but incompatible. Please install mmcv>=1.0.5, <=1.0.5.

Traceback (most recent call last):
  File "tools/test.py", line 12, in <module>
    from mmdet.apis import multi_gpu_test, single_gpu_test
  File "d:\a\a project\cv\mmdetection-master\mmdet\__init__.py", line 25, in <module>
    f'MMCV=={mmcv.__version__} is used but incompatible. ' \
AssertionError: MMCV==1.1.0 is used but incompatible. Please install mmcv>=1.0.5, <=1.0.5.
mmcv

The version needs to be 1.0.5, and the default installation is 1.1.0.

Unload mmcv first

pip uninstall mmcv
pip uninstall mmcv-full

Then install the version of mmcv as 1.0.5

pip install mmcv==1.0.5

ModuleNotFoundError: No module named ‘mmcv._ext

Problem: when installing mmdetection, mmcv is often installed, module not founderror: no module named ‘mmcv_ The problem of ext ‘pip install mmcv

use:

pip install mmcv-full

If you have any strange problems, please use the version of mmcv that matches your environment, such as:

pip install mmcv-full==latest+torch1.5.0+cu101 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html

For the specific version, please refer to the GitHub description of mmcv. The link is as follows:

https://github.com/open-mmlab/mmcv

ValueError: num_samples should be a positive integer value, but got num_samp=0

I encountered some problems while debugging the code on baseline. At that time, I reported an error and couldn’t find the reason repeatedly. Later, inspired by the following blog, I finally solved the problem. I will summarize this problem again

https://blog.csdn.net/xnmc2014/article/details/85557384

The problem may be the following: pay attention to the parameters when calling dataloder

self.train_dataloader = DataLoader(train_dataset, batch_size=TrainOption.train_batch_size, shuffle=TRUE, num_workers=TrainOption.data_load_worker_num)

The parameter setting of shuffle is wrong, because there is already a batch_ Sample, there is no need to shuffle for random sample, so shuffle here should be set to false.

package xxx does not exist cannot find symbol

When deploying services on Linux, a large number of packages were thrown and no exception was found

[ERROR] /home/jenkins/agent/workspace/pipeline_p-h6sbk-4/src/main/java/com/UserServiceImpl.java:[3,28] package com.alibaba.fastjson does not exist

[ERROR] /home/jenkins/agent/workspace/pipeline_p-h6sbk-4/src/main/java/com/User.java:[9,2] cannot find symbol

[ERROR]   symbol: class Data

[ERROR]   location: class com.xxx

[ERROR] /home/jenkins/agent/workspace/pipeline_p-h6sbk-4/src/main/java/com/User.java:[3,14] package lombok does not exist

[ERROR] /home/jenkins/agent/workspace/pipeline_p-h6sbk-4/src/main/java/com/User.java:[9,2] cannot find symbol

[ERROR]   symbol: class Data

[ERROR]   location: class com.xxx

[ERROR] -> [Help 1]

[ERROR] 

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR] 

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

This is Maven’s problem

    check whether the settings.xml file is configured. Check & lt; in the settings.xml file; localRepository> If the path is configured correctly, & lt; mirror> Whether the image address is correct and the network is unblocked. Whether the jar package and the corresponding version exist in Maven warehouse. Whether the Maven version configured in pom.xml corresponds to the Linux Installation version

NPM and cnpm installation failure solution

First, post the error: here is my error log:

0 info it worked if it ends with ok
1 verbose cli [ 'D:\\nodejs\\node.exe',
1 verbose cli   'D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'cnpm',
1 verbose cli   '--registry=https://registry.npm.taobao.org' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 026191e276c3f621
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for cnpm@latest request to https://registry.npm.taobao.org/cnpm failed, reason: connect ETIMEDOUT 93.184.216.34:8080
8 timing stage:rollbackFailedOptional Completed in 1ms
9 timing stage:runTopLevelLifecycles Completed in 133469ms
10 verbose type system
11 verbose stack FetchError: request to https://registry.npm.taobao.org/cnpm failed, reason: connect ETIMEDOUT 93.184.216.34:8080
11 verbose stack     at ClientRequest.req.on.err (D:\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
11 verbose stack     at ClientRequest.emit (events.js:189:13)
11 verbose stack     at onerror (D:\nodejs\node_modules\npm\node_modules\agent-base\index.js:100:9)
11 verbose stack     at callbackError (D:\nodejs\node_modules\npm\node_modules\agent-base\index.js:122:5)
11 verbose stack     at process._tickCallback (internal/process/next_tick.js:68:7)
12 verbose cwd C:\Users\Administrator.L6BFMF7743P5SU1
13 verbose Windows_NT 10.0.17763
14 verbose argv "D:\\nodejs\\node.exe" "D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "cnpm" "--registry=https://registry.npm.taobao.org"
15 verbose node v10.15.3
16 verbose npm  v6.4.1
17 error code ETIMEDOUT
18 error errno ETIMEDOUT
19 error network request to https://registry.npm.taobao.org/cnpm failed, reason: connect ETIMEDOUT 93.184.216.34:8080
20 error network This is a problem related to network connectivity.
20 error network In most cases you are behind a proxy or have bad network settings.
20 error network
20 error network If you are behind a proxy, please make sure that the
20 error network 'proxy' config is set properly.  See: 'npm help config'
21 verbose exit [ 1, true ]

Installed many times, are the same error, the installation of online solutions to try a lot of unresolved. Later, according to the log, it was found that it was the agent setting problem.

At first, I thought that the Taobao agent was not effective. Later, when I installed cnpm, I found the same problem, but it was not the problem of Taobao setting.

Note the proxy address printed in the log: 93.184.216.34:8080.

Solution: set the above address and port as proxy

Step one:

npm config set prefix "D:\nodejs\node_global"

Step 2:

npm config set cache "D:\nodejs\node_cache"

Step 3:

npm config set proxy 93.184.216.34:8080

Step 4:

npm config set https-proxy 93.184.216.34:8080

last:

npm install -g cnpm --registry=https://registry.npm.taobao.org

After the above execution, you can enter: cnpm – V to test

 
Refer to node for specific installation process . JS installation and cnpm configuration

Reference article: NPM and cnpm (Windows) installation steps

                   npm ERR ! network connect ETIMEDOUT

With root cause solution

Phenomenon: 1. There is no exception when the project starts, when the page is loaded into the spring:message In the background, the null pointer is abnormal, and the console will display the prompt with root cause;

2. Note out spring:message After related tags, there is no exception, but where the specific content should be displayed, the code value in the tag is displayed;

3. The same project can be used on other people’s computers, but not on my computer;

4. Available on eclipse, not on MyEclipse;

Reason: there is a space in the Tomcat installation path;

Solution: put the Tomcat of the deployment project in a path without spaces, such as the root directory.

The above are the phenomena and solutions I encountered. If there are any other phenomena and solutions, please add.

Java Error | Error:java: Compilation failed: internal java compiler error

Background

Error:java: Compilation failed: internal java compiler error

According to previous experience, the compiling environment of the read project is reset, and the JDK version is all specified as 1.8
1. Setting – & gt; Java complier

2.Project Structure->Modules

After the above steps are set, the same error will be reported in the recompile run

Solution

After investigation, the project Pom.xml The file does not specify a compiled version, in the Pom.xml Add the following plug-ins:

<build>

    <plugins>
        <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>utf-8</encoding>
            </configuration>
        </plugin>
    </plugins>

</build>

How to Solve Error: java.io.IOException: Resource [classpath:shiro.ini] could not be found.

scene

When Tomcat starts, it always reports an error. It can’t find the configuration file in the classpath, but the configuration file has been placed in the resource directory

 

 

Solution

The reason for this exception is that the new conf folder cannot be recognized, because it is not set as a resource folder. Just right click the conf folder – >build path – > use as source folder

 

 

 

Nutz framework: using native SQL for CND conditions

case

Today, I received a temporary business requirement. It takes a day or two for a simple filter to be used as a temporary business. So I thought of adding a not like to the original CND condition for filtering. However, I found that the existing CND condition query does not seem to meet the requirement

 

Solution

Using static class in Nutz framework to realize custom SQL and Cnd.and () splicing, new static (“xxxxx”) can connect any native SQL

 

cnd.and( new Static("job.ADDRESS not like '%GuangDong%'") );

 

 

 

 

 

 

Multithreading: when doing unit test, use thread pool to find that the specified code is not running and skip directly

Today, we did a unit test to debug the interface. We found that the interface call was successful, but we did not run the thread pool execution method. Instead, we directly skipped the execution code

 

 ExecutorService pool = Executors.newFixedThreadPool( 2 );

 

 public void callInterfaceCreditease(final String idcard,final String name,final String mobile){
        try{
            
            ExecutorService pool = Executors.newFixedThreadPool( 2 );
            //Interface
            pool.execute(new Runnable() {
                @Override
                public void run() {
                    creditCardCrediteaseService.doFetchCreditData(name, idcard, mobile);
                }
            });
            //Release thread pool resources
            pool.shutdown();
        }catch(Exception e){
            log.error("Calling interface exceptions:",e);
        }
                
    }

 

Shrio | java.io.IOException: Resource [classpath:shiro.ini] could not be found

case

case

java.io.IOException: Resource [classpath:shiro.ini] could not be found

Directory of Shiro file:

Solution

After troubleshooting, there is no problem with the file storage directory structure, but the bytecode file directory under target is still the old storage location, under conf/instead of the class directory. Therefore, you can know that this exception must be a compilation problem. Just delete the whole target directory and recompile it