Tag Archives: Bugs

[Solved] Conda install Error: An HTTP error occurred when trying to retrieve this URL. HTTP errors are often…

1. Problem Description: prepare to execute the following command in Anaconda prompt:

conda install -c stellargraph stellargraph

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.

2. Solution: open “C:\users\your computer name\condarc

Delete all lines in condarc, copy and paste the following code, and then save:

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - defaults
show_channel_urls: true
ssl_verify: true

(anyway, I can finally succeed in this file with the above code. I don’t know if you can do it.

3. Re run

conda install -c stellargraph stellargraph
    1. as long as you don’t report an error (try it several times, it may not work well). Maybe it will take a long time. Please be patient. If you want to improve the speed, you’d better create a new virtual environment and install the software, which will be much faster

Create a new environment ( CONDA env create - n env_name ) and install the software. In this way, the compatibility with the existing software will not be considered. It can also greatly reduce the search space and improve the speed of resolving software dependencies.

Internalerror: GPU sync failed error (How to Solve)

1. Error reporting: (from Python deep learning p178-179)

When vscode runs the following code in Jupiter notebook, an error is reported: internalerror: GPU sync failed

from tensorflow.keras.models import Sequential
from tensorflow.keras import layers
from tensorflow.keras.optimizers import RMSprop

model = Sequential()
model.add(layers.Flatten(input_shape=(lookback // step, float_data.shape[-1])))
model.add(layers.Dense(32, activation='relu'))
model.add(layers.Dense(1))

model.compile(optimizer=RMSprop(), loss='mae')
history = model.fit_generator(train_gen,
                              steps_per_epoch=500,
                              epochs=20,
                              validation_data=val_gen,
                              validation_steps=val_steps)

2. Solution:

(1) Don’t open too many ipynb file windows. There is only one running window left. Restart and there should be no problem.

(2) Some friends said that they might have something to do with the wallpaper engine. Just turn it off. I haven’t verified this yet.

However, I found that when the wallpaper engine dynamic desktop is displayed, the GPU utilization will increase sharply:

【Bug-python】IndexError: list index out of range

IndexError: list index out of range
Error message:

The code is as follows:
with open(“linux_Yue_01.txt”,”r”) as testFile:
testfileList = [splitFileNameAndLabel(filename = v) for v testFile.read().split(“\n”)]
The picture is as follows:

Error analysis:
The “IndexError: list index out of range” error typically occurs in two ways:
The first possible case:
List [index] Index is out of range
The second possibility:
The list is empty, with no elements
Listing [0] will report this error.
Typically, there is a problem with externally entered data, so it is usually processed once after readlines or read.
This avoids empty lines, insufficient fields, and type-casting errors.
Solutions:
For the first case, check the code through debugging, not much to say.
In the second case, there are two ways:
The first: check the data read in is there a problem, such as read in the TXT file whether there is a blank line and so on, but I more advocate the second solution, in the code error correction.
with open(“linux_Yue_01.txt”,”r”) as testFile:
testfileList = []
for v testFile.read().split(“\n”)
If not v.strip(): # string remove the space is not empty
continue
testfileList.extend([splitFileNameAndLabel(v)])
Note: [splitFileNameAndLabel(v)] is square again, otherwise it would not be a nested list in a list
The picture is as follows:

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0

1。问题描述

利用maven导包,运行Mybatis案例的主要函数时报的错。

[ERROR] 执行目标org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (default-cli)项目mybatis_annotation:命令执行失败。:进程退出错误:1(退出值:1)->
[ERROR]
[ERROR]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。
[ERROR]使用-X开关重新运行Maven以启用完整的调试日志记录。
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException


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

2。解决办法(三种可参考的方法)

方法一:<字体>在pom.xm中添加以下内容——<代码> exec-maven-plugin

 <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>
<!--                <executions>-->
<!--                    <execution>-->
<!--                        <goals>-->
<!--                            <goal>java</goal>-->
<!--                        </goals>-->
<!--                    </execution>-->
<!--                </executions>-->
                <configuration>
                    <classpathScope>test</classpathScope>
<!--                    <mainClass>com.itheima.test.MybatisTest</mainClass>-->
                </configuration>
            </plugin>
        </plugins>
    </build>

annotation section can not add

method 2: modify code

note: this error will sometimes occur after adding ** check the code section of the main function for errors. ** if the resource is closed before the method is called, etc.

method three: reference source inside the. Idea file to replace their own creation maven project. Idea file.

can also solve the problem of confused Chinese code, which can be seen as the reason for the initial configuration of idea. I haven’t found the specific configuration method yet, please inform me if there are specific configuration change steps or other reasons. Thanks for

here


. Analyze the reason

I replaced the main function with @test to run the Test method. The code can run normally, but it still won’t work if I replace it with the main function again. Two plugins need to be introduced here: maven-compiler-plugin and Exec-Maven-Plugin.
**maven-compiler-plugin: ** compiling Java code, you can specify the JDK version of the project source code, the compiled JDK version, and the code
exec-maven-plugin : to execute the class file, where the plug-in configuration should specify the path to execute the class. Only the exec-maven-plugin

is concerned here
4. Call database Chinese garbled code problem

1. The first type: in setting-> maven-> Runner-> VM Options
enter -dfile.encoding =gb2312
the first method is not bad, and the second method is not good, but I think it will be used in other places, code here first
2. The second type: po. XML type to add

<properties>
	<!-- 文件拷贝时的编码 -->
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
	<!-- 编译时的编码 -->
    <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
</properties>

5. Internal label analysis

1.< goal > The exec consists of two goals :exec :exec and exec: Java. How should you choose?First, you need to remember that exec:exec is always more powerful and flexible than ExEC: Java, except that the main difference between the two is in thread management: Exec: Exec always starts a new thread and exits (closes the application) from the VM when only daemon threads are left. For exec: Java, when all non-daemon threads terminate, the daemon thread is interrupted by Joine or interrupt and should not be closed. But for the average user, the difference doesn’t matter. For both options, in general, if your project is very easy to start without setting JVM parameters, system properties, or command-line arguments, use exec: Java,

2.< classpathScope >

compile
is compile by default, so we don’t configure anything, so we just mean compile. Compile means that the dependent project needs to participate in the compilation of the current project. Of course, subsequent tests, the run cycle also participate in the compilation, so it is a strong dependency. When packing, you usually need to include it.

test
scope for test indicates that the dependent project only participates in test-related work, including compiling and executing the test code. Typical examples are junit.

Runntime indicates that the dependent project does not need to participate in compiling the project, but it does need to participate in the later test and run cycles. Compared to compile, we skip compilation, which, frankly, isn’t very different from compile in terminal projects (non-open source, internal enterprise systems). Relatively common implementation such as JSR×××, the corresponding API JAR is compile, the specific implementation is runtime, compile only needs to know the interface is enough. A good example is the Oracle JDBC driver package, which generally has a scope of runntime. In addition, the dependency of runntime is usually used with optional, which is true. I can do it with A, or I can do it with B.

Provided provided means you can package it without having to package it, and other facilities (Web Container) provide it. In fact, this dependency can theoretically be involved in compiling, testing, running, and so on. So we compile, but we do exclude in the packaging phase.

In terms of engagement, it also provides the same. However, dependencies are not captured from maven repository, but from local file system, which must be used with the systemPath attribute.