Tag Archives: report errors

[Solved] Matplotlib scatter Draw Error: TypeError: ufunc ‘sqrt‘ not supported for the input types…rule ‘‘safe‘‘

Errors are reported as follows:

The solution is as follows:

Original program:
plt.scatter (x, y, ‘R’, label =’original scatter ‘)
modified as:
plt.scatter (x, y, C =’r’, label =’original scatter ‘)

The color setting parameter is set to: C = ‘R’

The problem was successfully resolved as follows:

[Solved] Uncaught (in promise) TypeError: XXX.a is not a constructor

Tips:

Solution:

Step 1:

npm add vue-grid- [email protected] -beta1

Step 2:
Import vuegridlayout from ‘Vue grid layout’ in
mian.js

Add: .use (vuegridlayout)
createapp (APP).use (Axios).use (router).use (vuegridlayout).mount (‘#app’)

Because Vue grid layout is vue2, but you use vue3, you need to install the dependencies and related configurations of vue3

[Solved] Error ‘false‘ undeclared (first use in this function)

Error: ‘false’ undeclared (first use in this function)

When you knock the code with DEVC + +, you will report an error to the following program

bool ok(int t){
	//Determine whether the tth person's job is assigned or not; if it is not assigned then a[j] = 0, otherwise a[j] = 1. 
	int i;
	for(i=0;i<t;i++)
		if(a[i]==a[t])
			return false;
		return true;
}

analysis:

There are no these keywords in real C. There is no keyword bool in C and early C + +. Bool can be used, but bool is not a built-in type. It is defined through typedef or macros. It is usually defined as int type. Later, the built-in type bool appeared in C + +, and the values can only be true (1) and false (0).

Solution 1:

Change the file type to CPP

Solution 2:

Macro definition of bool:

typedef enum __bool { false = 0, true = 1, } bool; 

ERROR: Could not find a version that satisfies the requirement tensorfolw==1.14

ERROR: Could not find a version that satisfies the requirement tensorfolw==1.14

After configuring the Linux environment, an error “error: could not find a version that satisfies the requirement tensorflow = = 1.14” appears when installing tensorflow

Error

Check the reason. It is found that the installed version of acaconda is too high, so the matching version of tensorflow cannot be found
the original version of Anaconda was Anaconda 3-5.3.0

terms of settlement

Reduce Anaconda version 3-5.3.0 to Anaconda version 3-5.2.0 to install tensorflow = = 1.14.0 .

installation command

wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh

If it is shown in the figure below, anaconda3-5.2.0 is successfully installed

Install tensorfolw = = 1.14.0

error: expected ‘;‘ at end of member declaration and expected ‘)‘ before ‘&‘ toke Errors

error: expected ‘;’ at end of member declaration
error: expected ‘)’ before ‘&’ Token
error reporting

When developing c + + in Linux environment, the following compilation errors or other inexplicable errors occur while ensuring that there are no errors in the code

	error: expected ';' at end of member declaration
	error: expected ‘)’ before ‘&’ toke

Solution:
check whether the header file contains circularly. For example, a.cpp contains B.H, b.cpp contains C.H, and c.cpp contains A.H to form a ring. In this case, an error will be reported.

Error condahtterror: http 000 connection failed

Error condahtterror: http 000 connection failed

CONDA create-n Python 36 Python =3.6 error condahtterror: http 000 connection failed for URL

CONDA create-n Python 36 python = = 3.6

ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ

C:\Users\Administrator>conda create -n python36 python==3.6
Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/current_repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64'

terms of settlement

Modify the file. Condarc
in C: \ users \ administrator directory to read:

channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
show_channel_urls: true

Python learning notes (5) — cross entropy error runtimeerror: 1D target tensor expected, multi target not supported

When I use cross entropy as the loss function, an error occurs:

RuntimeError: 1D target tensor expected, multi-target not supported

I checked the relevant information, and the statements in it are basically:

    the dimension of the input labels should be 1, and the precision cannot be double. It must be replaced by long; Dimensionality reduction of the input label

    But it can’t solve my problem, because my tag data has been processed with the following code after processing:

    torch.LongTensor(labels)
    

    And I also printed the dimension of my label data:

    torch.Size([16, 11])
    

    Here 16 refers to batch_ Size , so it’s not a dimension problem.

    But I was inspired when I read this blog (runtimeerror: multi target not supported at). It says:

    When calculating the cross entropy loss function in pytorch, the correct label input cannot be in one hot format. The function will process itself into one hot format. Therefore, you do not need to enter [0 1], just enter 4.

    My tag data is a multi tag problem, as follows:

    tensor([0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0])
    

    Then, when passing through loss , crossentropyloss will automatically code it as one-hot , which will increase it by one dimension to:

    tensor([[1., 0.],
            [0., 1.],
            [1., 0.],
            [1., 0.],
            [0., 1.],
            [1., 0.],
            [1., 0.],
            [0., 1.],
            [0., 1.],
            [1., 0.],
            [1., 0.]])
    

    This leads to the error.

    Therefore, the solution is to use the loss function of the multi label problem. For example, multilabelsoftmarginloss , or the most original mselos .

    reference resources

    [1] Wang’s technical road. Runtimeerror: multi target not supported at [EB/OL]. (December 10, 2019) [October 27, 2021] https://www.cnblogs.com/blogwangwang/p/12018897.html
    [2] Python free. Solution of “one-dimensional target tensor expectation, multi-objective unsupported” in cross entropy loss function, calculation, lossfunction, error report, 1dtargettensorexpected, multitargetnotsupported, Solution [EB/OL] (2020-07-04) [2021-10-27] https://www.pythonf.cn/read/125399

Front end project runtime prompts syntax error: typeerror: token.type.endswith is not a function solution

Reference documents:

https://www.baidu.com/link?url=rxkuHBNVNB0i7GCoDEfgkwDr3AllV9XWRLWwkFQl7p1PjamwyIPupL93spZDTywmxMetZ7yHNtqtgJRPGR0POa&amp ; wd=& eqid=d1c30348003392a90000000461721b6e

Problem background:

After pulling a branch for the project code, execute NPM install to download the dependent package, and then execute NPM run serve to find that the project fails to run. The prompt message is syntax error: typeerror: token.type.endswith is not a function.

Solution:

The author’s version of Babel eslint is 10.1.0, and the version is reduced to 8.2.2. The project is run again and runs successfully.

remarks:

The reason for the error seen on GitHub is that the version of Babel eslint is wrong, and the version reduction can indeed solve this problem. However, it is strange that the Babel eslint version of the author’s trunk is the same as that of the branch, both of which are 10.1.0, while the trunk project can run successfully, but the branch project can’t.

Gateway forwards weboskct with an error ClassCastException

    usage environment: the springcloud gateway forwards an error message to the websocket. Error message content:

    15:30:38.092 [http-nio-9999-exec-1] ERROR c.m.g.e.GlobalErrorWebExceptionHandler - [handle,38] - org.apache.catalina.connector.ResponseFacade cannot be cast to reactor.netty.http.server.HttpServerResponse
    java.lang.ClassCastException: org.apache.catalina.connector.ResponseFacade cannot be cast to reactor.netty.http.server.HttpServerResponse
    	at org.springframework.web.reactive.socket.server.upgrade.ReactorNettyRequestUpgradeStrategy.getNativeResponse(ReactorNettyRequestUpgradeStrategy.java:182)
    	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
    Error has been observed at the following site(s):
    	|_ checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
    	|_ checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
    	|_ checkpoint ⇢ HTTP GET "/sys/websocket/1" [ExceptionHandlingWebHandler]
    Stack trace:
    		at org.springframework.web.reactive.socket.server.upgrade.ReactorNettyRequestUpgradeStrategy.getNativeResponse(ReactorNettyRequestUpgradeStrategy.java:182)
    		at org.springframework.web.reactive.socket.server.upgrade.ReactorNettyRequestUpgradeStrategy.upgrade(ReactorNettyRequestUpgradeStrategy.java:162)
    		at org.springframework.web.reactive.socket.server.support.HandshakeWebSocketService.lambda$handleRequest$1(HandshakeWebSocketService.java:235)
    		at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:151)
    		at reactor.core.publisher.MonoFlatMap.subscribeOrReturn(MonoFlatMap.java:53)
    		at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57)
    		at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    		at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    		at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    		at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    		at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
    		at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    		at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    		at reactor.core.publisher.Mono.subscribe(Mono.java:4252)
    		at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.java:172)
    		at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:56)
    		at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
    		at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    		at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    		at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    		at com.alibaba.csp.sentinel.adapter.reactor.MonoSentinelOperator.subscribe(MonoSentinelOperator.java:40)
    		at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    		at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
    		at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    
      cause of error: dependency conflict
      the Tomcat servlet of springboot is used in the request and the Tomcat of gateway netty is used in the response, so the type conversion exception is caused. Solution: modify the gateway POM file:
      delete or exclude the following dependencies

      <dependency>
      	<groupId>javax.servlet</groupId>
      	<artifactId>javax.servlet-api</artifactId>
      </dependency>
       <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-web</artifactId>
       </dependency>
       <dependency>
      	<groupId>javax.servlet</groupId>
      	<artifactId>jstl</artifactId>
      </dependency>
      <dependency>
      	<groupId>org.apache.tomcat.embed</groupId>
      	<artifactId>tomcat-embed-jasper</artifactId>
      </dependency>
      

Brew Install python Error: tar: Error opening archive: Failed to open’***‘

Check the reason for the error. At first, I thought it was a permission problem and didn’t write it. After modifying the permission, I found that it still couldn’t be installed.

Check carefully and find that gdbm dependency is not installed.

terms of settlement

To install gdbm dependencies, enter the command line

brew install gdbm

The following indicates that the installation is successful

Finally, execute the command brew install again [email protected]

Installation succeeded!

Java: compilation failed: internal java compiler error and invalid source distribution resolution

Reason: it is mainly because the JDK version is inconsistent        

1. The compiled version does not match. 2. The current project JDK version does not support        

1. First, view the JDK of the project

File -> Project Structure-> Project Settings -> Project

                  1.8 must correspond to 8

Check whether the JDK of the current project (module) is the same as that of the project

2. Maven is used in the idea to build the project. The target bytecode version is automatically changed to 1.5     Because no JDK is specified in maven, it will be scanned as the default JDK version   View and set the java compiler version (target bytecode version)

File–> Setting–> Build,Execution,Deployment–>Compiler–> Java compiler sets the corresponding module

         The appropriate version of target bytecode version, such as JDK1.8     Change 1.5 above to 1.8

Solution:

Add Maven compiler plugin to pom.xml so that it will not automatically become 1.5

     <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>UTF-8</encoding>
                </configuration>
      </plugin>

[Solved] Unity Error: ‘BuildPipeline‘ does not contain a definition for ‘GetBuildTargetName‘

@[TOC] (error: Library \ packagecache \ com. Unity. XR [email protected] \Editor\XRGeneralBuildProcessor.cs(83,52): error CS0117: ‘BuildPipeline’ does not contain a definition for ‘GetBuildTargetName’)

Problem Description:

when unity develops oculus quest, it will report an error library \ packagecache \ com.unity.xr [email protected] \Editor \ xrgeneralbuildprocessor.cs (83,52): error cs0117: ‘buildpipeline’ doors not contain a definition for ‘getbuildtargetname’
my unit version is 2019.4


Cause analysis:

the version of the plug-in matches the version of the unity step, resulting in </ font>


Solution:

delete ar foundation, downgrade XR plug-in management to 3.2.16, downgrade ar foundation and arkit XR plug-ins to 4.1.1, and reinstall ar foundation
record the pit encountered and it has been solved