Explore all FTP open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in FTP

curl

7.82.0

sftpgo

v2.2.2

FarManager

v3.0.5965.2771

webMAN-MOD

webMAN MOD 1.47.40

nging

Popular Libraries in FTP

curl

by curl doticoncdoticon

star image 24730 doticonNOASSERTION

A command line tool and library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP. libcurl offers a myriad of powerful features

git-ftp

by git-ftp doticonshelldoticon

star image 4987 doticonGPL-3.0

Uses Git to upload only changed files to FTP servers.

sftpgo

by drakkan doticongodoticon

star image 4017 doticonAGPL-3.0

Fully featured and highly configurable SFTP server with optional HTTP/S, FTP/S and WebDAV support - S3, Google Cloud Storage, Azure Blob

FluentFTP

by robinrodricks doticoncsharpdoticon

star image 1980 doticonMIT

An FTP and FTPS client for .NET & .NET Standard, optimized for speed. Provides extensive FTP commands, File uploads/downloads, SSL/TLS connections, Automatic directory listing parsing, File hashing/checksums, File permissions/CHMOD, FTP proxies, FXP support, UTF-8 support, Async/await support, Powershell support and more. Written entirely in C#, with no external dependencies.

pyftpdlib

by giampaolo doticonpythondoticon

star image 1317 doticonMIT

Extremely fast and scalable Python FTP server library

FarManager

by FarGroup doticonc++doticon

star image 1201 doticonBSD-3-Clause

File and Archive Manager

winscp

by winscp doticoncdoticon

star image 1118 doticonGPL-3.0

WinSCP is a popular free SFTP and FTP client for Windows, a powerful file manager that will improve your productivity. It supports also Amazon S3, FTPS, SCP and WebDAV protocols. Power users can automate WinSCP using .NET assembly.

node-ftp

by mscdex doticonjavascriptdoticon

star image 1029 doticonMIT

An FTP client module for node.js

ftp

by jlaffaye doticongodoticon

star image 897 doticonISC

FTP client package for Go

Trending New libraries in FTP

PortBrute

by awake1t doticongodoticon

star image 406 doticon

一款跨平台小巧的端口爆破工具,支持爆破FTP/SSH/SMB/MSSQL/MYSQL/POSTGRESQL/MONGOD / A cross-platform compact port blasting tool that supports blasting FTP/SSH/SMB/MSSQL/MYSQL/POSTGRESQL/MONGOD

ftpserver

by fclairamb doticongodoticon

star image 206 doticonMIT

Golang based autonomous FTP server with SFTP, S3, Dropbox, and Google Drive connectors.

fineftp-server

by continental doticonc++doticon

star image 139 doticonMIT

C++ FTP Server Library for Windows, Linux & more

php-ftp-client

by lazzard doticonphpdoticon

star image 62 doticonMIT

This library provides helper classes and methods to manage your FTP files in an OOP way.

ftp

by matthiaaas doticonjavascriptdoticon

star image 56 doticonMIT

[v2 announced!] React based Electron (S)FTP desktop application

spring-file-storage

by 1171736840 doticonjavadoticon

star image 37 doticonApache-2.0

在SpringBoot中通过简单的方式将文件存储到本地、阿里云OSS、华为云OBS、七牛云Kodo、腾讯云COS、百度云 BOS、又拍云USS、MinIO。后续即将支持 亚马逊S3、谷歌云存储、FTP、SFTP、WebDAV、Samba、NFS

FTP-browser

by Kelta-King doticonphpdoticon

star image 30 doticon

This FTP browser is a web-based file manager, kinda like Cpanel. FTP client can upload, download, delete, rename, edit and view all the files which have been uploaded by them using this FTP browser.

simple-ftp-deploy-action

by kevinpainchaud doticonshelldoticon

star image 29 doticon

Deploy files to an FTP server using GitHub actions

ocd_production

by derrickturk doticonrustdoticon

star image 20 doticonApache-2.0

Unpack and process a wcproduction.zip file from the New Mexico OCD's FTP site

Top Authors in FTP

1

honwhy

4 Libraries

star icon40

2

yob

4 Libraries

star icon189

3

jjolano

4 Libraries

star icon60

4

gezhaoyou

4 Libraries

star icon78

5

tobyink

3 Libraries

star icon7

6

ArchiveTeam

3 Libraries

star icon9

7

sunilmore690

3 Libraries

star icon20

8

sergi

3 Libraries

star icon780

9

Miladkhoshdel

3 Libraries

star icon12

10

contributte

3 Libraries

star icon27

1

4 Libraries

star icon40

2

4 Libraries

star icon189

3

4 Libraries

star icon60

4

4 Libraries

star icon78

5

3 Libraries

star icon7

6

3 Libraries

star icon9

7

3 Libraries

star icon20

8

3 Libraries

star icon780

9

3 Libraries

star icon12

10

3 Libraries

star icon27

Trending Kits in FTP

No Trending Kits are available at this moment for FTP

Trending Discussions on FTP

Stateful generators with Haskell pipes

Uploading a file to testcontainer FTP server fails with Connection refused after being connected

Can't install Python 3.10.0 with pyenv on MacOS

Unable to install pgAdmin 4 in ubuntu 21.10

"The format of the URI could not be determined" when combining absolute and relative URLs in C#

Compiling python 3.10 at Amazon Linux 2

Adding imagemagick into my php 7.4 docker raised error

Need understanding as to why string.StartsWith() is true when it should be false

How can I add values from the first column to a new array?

Debian 11 Update broke samueldebruyn/debian-git?

QUESTION

Stateful generators with Haskell pipes

Asked 2022-Mar-31 at 18:32
  1. Suppose I want to model, using Haskell pipes, a Python Generator[int, None, None] which keeps some internal state. Should I be using Producer int (State s) () or StateT s (Producer int m) (), where m is whatever type of effect I eventually want from the consumer?

  2. How should I think about the notion of transducers in pipes? So in Oleg's simple generators, there is

1type Transducer m1 m2 e1 e2  = Producer m1 e1 -> Producer m2 e2
2

but I don't know what the analog is in pipes, because any Proxy objects that interact seem to rely on the same underlying monad m, not switching from m1 to m2. See the Prelude functions, for instance.

I think I'm just misunderstanding something fundamental about the way pipes works. Thanks for your help.

ANSWER

Answered 2022-Mar-31 at 18:32

In pipes, you typically wouldn't use effects in the base monad m of your overall Effect to model the internal state of a Producer. If you really wanted to use State for this purpose, it would be an internal implementation detail of the Producer in question (discharged by a runStateP or evalStateP inside the Producer, as explained below), and the State would not appear in the Producer's type.

It's also important to emphasize that a Producer, even when it's operating in the Identity base monad without any "effects" at its disposal, isn't some sort of pure function that would keep producing the same value over and over without monadic help. A Producer is basically a stream, and it can maintain state using the usual functional mechanisms (e.g., recursion, for one). So, you definitely don't need a State for a Producer to be stateful.

The upshot is that the usual model of a Python Generator[int, None, None] in Pipes is just a Monad m => Producer Int m () polymorphic in an unspecified base monad m. Only if the Producer needs some external effects (e.g., IO to access the filesystem) would you require more of m (e.g., a MonadIO m constraint or something).

To give you a concrete example, a Producer that generates pseudorandom numbers obviously has "state", but a typical implementation would be a "pure" Producer:

1type Transducer m1 m2 e1 e2  = Producer m1 e1 -> Producer m2 e2
2randoms :: (Monad m) => Word32 -> Producer Int m ()
3randoms seed = do
4  let seed' = 1664525 * seed + 1013904223
5  yield $ fromIntegral seed'
6  randoms seed'
7

with the state maintained via recursion.

If you really decided to maintain this state via the State monad, the type of the Producer wouldn't change. You'd just use a State internally. The Pipes.Lift module provides some helpers (like evalStateP used here) to locally add a monad layer to facilitate this:

1type Transducer m1 m2 e1 e2  = Producer m1 e1 -> Producer m2 e2
2randoms :: (Monad m) => Word32 -> Producer Int m ()
3randoms seed = do
4  let seed' = 1664525 * seed + 1013904223
5  yield $ fromIntegral seed'
6  randoms seed'
7randoms' :: (Monad m) => Word32 -> Producer Int m ()
8randoms' seed = evalStateP seed $ forever $ do
9  x <- get
10  let x' = 1664525 * x + 1013904223
11  yield $ fromIntegral x'
12  put x'
13

Oleg's simple generators are entirely different. His producers and consumers produce and consume values only through monadic effects, and "monad changing" is central to the implementation. In particular, I believe his consumers and transducers can only maintain state via a monadic effect, like a State monad, though I'd have to look a little more carefully to be sure.

In contrast, pipes proxies can produce and consume values and maintain internal state independent of the underlying base monad.

Ultimately, the analog of Oleg's transducers in pipes are simply the Pipes. Both consume values from a producer and yield values to a consumer. The monad changing in Oleg's transducers is just an implementation detail.

Source https://stackoverflow.com/questions/71686259

QUESTION

Uploading a file to testcontainer FTP server fails with Connection refused after being connected

Asked 2022-Jan-07 at 12:23

I'm working with FTPClient against an FTP server using Testcontainers.

A reproducible code sample is here:

1import org.apache.commons.net.PrintCommandListener;
2import org.apache.commons.net.ftp.FTP;
3import org.apache.commons.net.ftp.FTPClient;
4import org.apache.commons.net.ftp.FTPReply;
5import org.junit.jupiter.api.AfterAll;
6import org.junit.jupiter.api.BeforeAll;
7import org.junit.jupiter.api.Test;
8import org.testcontainers.containers.GenericContainer;
9import org.testcontainers.images.builder.ImageFromDockerfile;
10import org.testcontainers.junit.jupiter.Testcontainers;
11
12import java.io.ByteArrayInputStream;
13import java.io.IOException;
14import java.io.InputStream;
15import java.io.PrintWriter;
16
17import static org.assertj.core.api.Assertions.assertThat;
18
19@Testcontainers
20class FtpUtilsTest {
21
22    private static final int PORT = 21;
23    private static final String USER = "user";
24    private static final String PASSWORD = "password";
25    private static final int FTP_TIMEOUT_IN_MILLISECONDS = 1000 * 60;
26
27    private static final GenericContainer ftp = new GenericContainer(
28        new ImageFromDockerfile()
29            .withDockerfileFromBuilder(builder ->
30                builder
31                    .from("delfer/alpine-ftp-server:latest")
32                    .build()
33            )
34    )
35        .withExposedPorts(PORT)
36        .withEnv("USERS", USER + "|" + PASSWORD);
37
38
39    @BeforeAll
40    public static void staticSetup() throws IOException {
41        ftp.start();
42    }
43
44    @AfterAll
45    static void afterAll() {
46        ftp.stop();
47    }
48
49    @Test
50    void test() throws IOException {
51        FTPClient ftpClient = new FTPClient();
52        ftpClient.setDataTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
53        ftpClient.setConnectTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
54        ftpClient.setDefaultTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
55
56        // Log
57        ftpClient.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out), true));
58
59        // Connect
60        try {
61            ftpClient.connect("localhost", ftp.getMappedPort(PORT));
62            ftpClient.setSoTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
63
64            int reply = ftpClient.getReplyCode();
65            if (!FTPReply.isPositiveCompletion(reply)) {
66                ftpClient.disconnect();
67                throw new AssertionError();
68            }
69
70            // Login
71            boolean loginSuccess = ftpClient.login(USER, PASSWORD);
72            if (!loginSuccess) {
73                throw new AssertionError();
74            }
75
76            ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
77            ftpClient.enterLocalPassiveMode();
78
79        } catch (IOException e) {
80            throw new AssertionError(e);
81        }
82
83        String remoteFile = "fileonftp";
84        try (InputStream targetStream = new ByteArrayInputStream("Hello FTP".getBytes())) {
85            assertThat(ftpClient.isConnected()).isTrue();
86            ftpClient.storeFile(remoteFile, targetStream);
87        }
88    }
89}
90

This prints:

1import org.apache.commons.net.PrintCommandListener;
2import org.apache.commons.net.ftp.FTP;
3import org.apache.commons.net.ftp.FTPClient;
4import org.apache.commons.net.ftp.FTPReply;
5import org.junit.jupiter.api.AfterAll;
6import org.junit.jupiter.api.BeforeAll;
7import org.junit.jupiter.api.Test;
8import org.testcontainers.containers.GenericContainer;
9import org.testcontainers.images.builder.ImageFromDockerfile;
10import org.testcontainers.junit.jupiter.Testcontainers;
11
12import java.io.ByteArrayInputStream;
13import java.io.IOException;
14import java.io.InputStream;
15import java.io.PrintWriter;
16
17import static org.assertj.core.api.Assertions.assertThat;
18
19@Testcontainers
20class FtpUtilsTest {
21
22    private static final int PORT = 21;
23    private static final String USER = "user";
24    private static final String PASSWORD = "password";
25    private static final int FTP_TIMEOUT_IN_MILLISECONDS = 1000 * 60;
26
27    private static final GenericContainer ftp = new GenericContainer(
28        new ImageFromDockerfile()
29            .withDockerfileFromBuilder(builder ->
30                builder
31                    .from("delfer/alpine-ftp-server:latest")
32                    .build()
33            )
34    )
35        .withExposedPorts(PORT)
36        .withEnv("USERS", USER + "|" + PASSWORD);
37
38
39    @BeforeAll
40    public static void staticSetup() throws IOException {
41        ftp.start();
42    }
43
44    @AfterAll
45    static void afterAll() {
46        ftp.stop();
47    }
48
49    @Test
50    void test() throws IOException {
51        FTPClient ftpClient = new FTPClient();
52        ftpClient.setDataTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
53        ftpClient.setConnectTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
54        ftpClient.setDefaultTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
55
56        // Log
57        ftpClient.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out), true));
58
59        // Connect
60        try {
61            ftpClient.connect("localhost", ftp.getMappedPort(PORT));
62            ftpClient.setSoTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
63
64            int reply = ftpClient.getReplyCode();
65            if (!FTPReply.isPositiveCompletion(reply)) {
66                ftpClient.disconnect();
67                throw new AssertionError();
68            }
69
70            // Login
71            boolean loginSuccess = ftpClient.login(USER, PASSWORD);
72            if (!loginSuccess) {
73                throw new AssertionError();
74            }
75
76            ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
77            ftpClient.enterLocalPassiveMode();
78
79        } catch (IOException e) {
80            throw new AssertionError(e);
81        }
82
83        String remoteFile = "fileonftp";
84        try (InputStream targetStream = new ByteArrayInputStream("Hello FTP".getBytes())) {
85            assertThat(ftpClient.isConnected()).isTrue();
86            ftpClient.storeFile(remoteFile, targetStream);
87        }
88    }
89}
90220 Welcome Alpine ftp server https://hub.docker.com/r/delfer/alpine-ftp-server/
91USER *******
92331 Please specify the password.
93PASS *******
94230 Login successful.
95TYPE I
96200 Switching to Binary mode.
97PASV
98227 Entering Passive Mode (172,17,0,3,82,15).
99[Replacing PASV mode reply address 172.17.0.3 with 127.0.0.1]
100

then fails with:

1import org.apache.commons.net.PrintCommandListener;
2import org.apache.commons.net.ftp.FTP;
3import org.apache.commons.net.ftp.FTPClient;
4import org.apache.commons.net.ftp.FTPReply;
5import org.junit.jupiter.api.AfterAll;
6import org.junit.jupiter.api.BeforeAll;
7import org.junit.jupiter.api.Test;
8import org.testcontainers.containers.GenericContainer;
9import org.testcontainers.images.builder.ImageFromDockerfile;
10import org.testcontainers.junit.jupiter.Testcontainers;
11
12import java.io.ByteArrayInputStream;
13import java.io.IOException;
14import java.io.InputStream;
15import java.io.PrintWriter;
16
17import static org.assertj.core.api.Assertions.assertThat;
18
19@Testcontainers
20class FtpUtilsTest {
21
22    private static final int PORT = 21;
23    private static final String USER = "user";
24    private static final String PASSWORD = "password";
25    private static final int FTP_TIMEOUT_IN_MILLISECONDS = 1000 * 60;
26
27    private static final GenericContainer ftp = new GenericContainer(
28        new ImageFromDockerfile()
29            .withDockerfileFromBuilder(builder ->
30                builder
31                    .from("delfer/alpine-ftp-server:latest")
32                    .build()
33            )
34    )
35        .withExposedPorts(PORT)
36        .withEnv("USERS", USER + "|" + PASSWORD);
37
38
39    @BeforeAll
40    public static void staticSetup() throws IOException {
41        ftp.start();
42    }
43
44    @AfterAll
45    static void afterAll() {
46        ftp.stop();
47    }
48
49    @Test
50    void test() throws IOException {
51        FTPClient ftpClient = new FTPClient();
52        ftpClient.setDataTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
53        ftpClient.setConnectTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
54        ftpClient.setDefaultTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
55
56        // Log
57        ftpClient.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out), true));
58
59        // Connect
60        try {
61            ftpClient.connect("localhost", ftp.getMappedPort(PORT));
62            ftpClient.setSoTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
63
64            int reply = ftpClient.getReplyCode();
65            if (!FTPReply.isPositiveCompletion(reply)) {
66                ftpClient.disconnect();
67                throw new AssertionError();
68            }
69
70            // Login
71            boolean loginSuccess = ftpClient.login(USER, PASSWORD);
72            if (!loginSuccess) {
73                throw new AssertionError();
74            }
75
76            ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
77            ftpClient.enterLocalPassiveMode();
78
79        } catch (IOException e) {
80            throw new AssertionError(e);
81        }
82
83        String remoteFile = "fileonftp";
84        try (InputStream targetStream = new ByteArrayInputStream("Hello FTP".getBytes())) {
85            assertThat(ftpClient.isConnected()).isTrue();
86            ftpClient.storeFile(remoteFile, targetStream);
87        }
88    }
89}
90220 Welcome Alpine ftp server https://hub.docker.com/r/delfer/alpine-ftp-server/
91USER *******
92331 Please specify the password.
93PASS *******
94230 Login successful.
95TYPE I
96200 Switching to Binary mode.
97PASV
98227 Entering Passive Mode (172,17,0,3,82,15).
99[Replacing PASV mode reply address 172.17.0.3 with 127.0.0.1]
100Connection refused (Connection refused)
101java.net.ConnectException: Connection refused (Connection refused)
102    ...
103    at java.base/java.net.Socket.connect(Socket.java:609)
104    at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:866)
105    at org.apache.commons.net.ftp.FTPClient._storeFile(FTPClient.java:1053)
106    at org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:3816)
107    at org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:3846)
108

What I don't understand is that it fails after successfully connecting and logging in, and returning true for isConnected.


Turns out that when removing the ftpClient.enterLocalPassiveMode(); it works, but I need it to work with the passive mode.

I guess the failure is related when switching to a different port for the passive call.

but when trying to add the ports to the withExposedPorts the container fails to start with:

1import org.apache.commons.net.PrintCommandListener;
2import org.apache.commons.net.ftp.FTP;
3import org.apache.commons.net.ftp.FTPClient;
4import org.apache.commons.net.ftp.FTPReply;
5import org.junit.jupiter.api.AfterAll;
6import org.junit.jupiter.api.BeforeAll;
7import org.junit.jupiter.api.Test;
8import org.testcontainers.containers.GenericContainer;
9import org.testcontainers.images.builder.ImageFromDockerfile;
10import org.testcontainers.junit.jupiter.Testcontainers;
11
12import java.io.ByteArrayInputStream;
13import java.io.IOException;
14import java.io.InputStream;
15import java.io.PrintWriter;
16
17import static org.assertj.core.api.Assertions.assertThat;
18
19@Testcontainers
20class FtpUtilsTest {
21
22    private static final int PORT = 21;
23    private static final String USER = "user";
24    private static final String PASSWORD = "password";
25    private static final int FTP_TIMEOUT_IN_MILLISECONDS = 1000 * 60;
26
27    private static final GenericContainer ftp = new GenericContainer(
28        new ImageFromDockerfile()
29            .withDockerfileFromBuilder(builder ->
30                builder
31                    .from("delfer/alpine-ftp-server:latest")
32                    .build()
33            )
34    )
35        .withExposedPorts(PORT)
36        .withEnv("USERS", USER + "|" + PASSWORD);
37
38
39    @BeforeAll
40    public static void staticSetup() throws IOException {
41        ftp.start();
42    }
43
44    @AfterAll
45    static void afterAll() {
46        ftp.stop();
47    }
48
49    @Test
50    void test() throws IOException {
51        FTPClient ftpClient = new FTPClient();
52        ftpClient.setDataTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
53        ftpClient.setConnectTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
54        ftpClient.setDefaultTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
55
56        // Log
57        ftpClient.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out), true));
58
59        // Connect
60        try {
61            ftpClient.connect("localhost", ftp.getMappedPort(PORT));
62            ftpClient.setSoTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
63
64            int reply = ftpClient.getReplyCode();
65            if (!FTPReply.isPositiveCompletion(reply)) {
66                ftpClient.disconnect();
67                throw new AssertionError();
68            }
69
70            // Login
71            boolean loginSuccess = ftpClient.login(USER, PASSWORD);
72            if (!loginSuccess) {
73                throw new AssertionError();
74            }
75
76            ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
77            ftpClient.enterLocalPassiveMode();
78
79        } catch (IOException e) {
80            throw new AssertionError(e);
81        }
82
83        String remoteFile = "fileonftp";
84        try (InputStream targetStream = new ByteArrayInputStream("Hello FTP".getBytes())) {
85            assertThat(ftpClient.isConnected()).isTrue();
86            ftpClient.storeFile(remoteFile, targetStream);
87        }
88    }
89}
90220 Welcome Alpine ftp server https://hub.docker.com/r/delfer/alpine-ftp-server/
91USER *******
92331 Please specify the password.
93PASS *******
94230 Login successful.
95TYPE I
96200 Switching to Binary mode.
97PASV
98227 Entering Passive Mode (172,17,0,3,82,15).
99[Replacing PASV mode reply address 172.17.0.3 with 127.0.0.1]
100Connection refused (Connection refused)
101java.net.ConnectException: Connection refused (Connection refused)
102    ...
103    at java.base/java.net.Socket.connect(Socket.java:609)
104    at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:866)
105    at org.apache.commons.net.ftp.FTPClient._storeFile(FTPClient.java:1053)
106    at org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:3816)
107    at org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:3846)
108Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [55600, 55601, 55602, 55603, 55604, 55605, 55606, 55607, 55608, 55609, 55598, 55599] should be listening)
109

Running against a docker (docker run -d -p 21:21 -p 21000-21010:21000-21010 -e USERS="user|password" delfer/alpine-ftp-server) works.

Local docker versions:

  • Docker version 20.10.11, build dea9396
  • Docker Desktop 4.3.1

Testcontainers - appears to behave the same both on 1.16.2 and 1.15.3

Link to testcontainers discussion

ANSWER

Answered 2021-Dec-16 at 00:06

As you already figured out in the comments, the tricky part about FTP passive mode is that the server uses another port (not 21) for communication. In the docker image you're using, it's a port from the 21000-21010 range by default. So you need to publish (expose) these additional container ports. In docker run command you used -p 21000-21010:21000-21010 for that.

However, Testcontainers library is designed to publish to random host ports to avoid the problem, when a desired fixed port (or a range of ports) is already occupied on the host side. In case of FTP passive mode random ports on the host side cause problems, because afaik you can't instruct the ftp client to override the port, which FTP server returned for the passive mode. You'd need something like ftpClient.connect("localhost", ftp.getMappedPort(PORT)); but for passive mode ports as well.

Therefore the only solution I see here is to use a FixedHostPortContainer. Even though it's marked as deprecated and not recommended to use because of the mentioned issues with occupied ports, I think this is a valid use case for it here. FixedHostPortGenericContainer allows to publish fixed ports on the host side. Something like:

1import org.apache.commons.net.PrintCommandListener;
2import org.apache.commons.net.ftp.FTP;
3import org.apache.commons.net.ftp.FTPClient;
4import org.apache.commons.net.ftp.FTPReply;
5import org.junit.jupiter.api.AfterAll;
6import org.junit.jupiter.api.BeforeAll;
7import org.junit.jupiter.api.Test;
8import org.testcontainers.containers.GenericContainer;
9import org.testcontainers.images.builder.ImageFromDockerfile;
10import org.testcontainers.junit.jupiter.Testcontainers;
11
12import java.io.ByteArrayInputStream;
13import java.io.IOException;
14import java.io.InputStream;
15import java.io.PrintWriter;
16
17import static org.assertj.core.api.Assertions.assertThat;
18
19@Testcontainers
20class FtpUtilsTest {
21
22    private static final int PORT = 21;
23    private static final String USER = "user";
24    private static final String PASSWORD = "password";
25    private static final int FTP_TIMEOUT_IN_MILLISECONDS = 1000 * 60;
26
27    private static final GenericContainer ftp = new GenericContainer(
28        new ImageFromDockerfile()
29            .withDockerfileFromBuilder(builder ->
30                builder
31                    .from("delfer/alpine-ftp-server:latest")
32                    .build()
33            )
34    )
35        .withExposedPorts(PORT)
36        .withEnv("USERS", USER + "|" + PASSWORD);
37
38
39    @BeforeAll
40    public static void staticSetup() throws IOException {
41        ftp.start();
42    }
43
44    @AfterAll
45    static void afterAll() {
46        ftp.stop();
47    }
48
49    @Test
50    void test() throws IOException {
51        FTPClient ftpClient = new FTPClient();
52        ftpClient.setDataTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
53        ftpClient.setConnectTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
54        ftpClient.setDefaultTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
55
56        // Log
57        ftpClient.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out), true));
58
59        // Connect
60        try {
61            ftpClient.connect("localhost", ftp.getMappedPort(PORT));
62            ftpClient.setSoTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
63
64            int reply = ftpClient.getReplyCode();
65            if (!FTPReply.isPositiveCompletion(reply)) {
66                ftpClient.disconnect();
67                throw new AssertionError();
68            }
69
70            // Login
71            boolean loginSuccess = ftpClient.login(USER, PASSWORD);
72            if (!loginSuccess) {
73                throw new AssertionError();
74            }
75
76            ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
77            ftpClient.enterLocalPassiveMode();
78
79        } catch (IOException e) {
80            throw new AssertionError(e);
81        }
82
83        String remoteFile = "fileonftp";
84        try (InputStream targetStream = new ByteArrayInputStream("Hello FTP".getBytes())) {
85            assertThat(ftpClient.isConnected()).isTrue();
86            ftpClient.storeFile(remoteFile, targetStream);
87        }
88    }
89}
90220 Welcome Alpine ftp server https://hub.docker.com/r/delfer/alpine-ftp-server/
91USER *******
92331 Please specify the password.
93PASS *******
94230 Login successful.
95TYPE I
96200 Switching to Binary mode.
97PASV
98227 Entering Passive Mode (172,17,0,3,82,15).
99[Replacing PASV mode reply address 172.17.0.3 with 127.0.0.1]
100Connection refused (Connection refused)
101java.net.ConnectException: Connection refused (Connection refused)
102    ...
103    at java.base/java.net.Socket.connect(Socket.java:609)
104    at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:866)
105    at org.apache.commons.net.ftp.FTPClient._storeFile(FTPClient.java:1053)
106    at org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:3816)
107    at org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:3846)
108Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [55600, 55601, 55602, 55603, 55604, 55605, 55606, 55607, 55608, 55609, 55598, 55599] should be listening)
109    private static final int PASSIVE_MODE_PORT = 21000;
110    ...
111    private static final FixedHostPortGenericContainer ftp = new FixedHostPortGenericContainer<>(
112            "delfer/alpine-ftp-server:latest")
113            .withFixedExposedPort(PASSIVE_MODE_PORT, PASSIVE_MODE_PORT)
114            .withExposedPorts(PORT)
115            .withEnv("USERS", USER + "|" + PASSWORD)
116            .withEnv("MIN_PORT", String.valueOf(PASSIVE_MODE_PORT))
117            .withEnv("MAX_PORT", String.valueOf(PASSIVE_MODE_PORT));
118

Keep in mind that this solution relies on the assumption that 21000 port is always free. If you're going to run this in the environment where it's not guaranteed, then you need to tweak it to find a free host port first. Like:

1import org.apache.commons.net.PrintCommandListener;
2import org.apache.commons.net.ftp.FTP;
3import org.apache.commons.net.ftp.FTPClient;
4import org.apache.commons.net.ftp.FTPReply;
5import org.junit.jupiter.api.AfterAll;
6import org.junit.jupiter.api.BeforeAll;
7import org.junit.jupiter.api.Test;
8import org.testcontainers.containers.GenericContainer;
9import org.testcontainers.images.builder.ImageFromDockerfile;
10import org.testcontainers.junit.jupiter.Testcontainers;
11
12import java.io.ByteArrayInputStream;
13import java.io.IOException;
14import java.io.InputStream;
15import java.io.PrintWriter;
16
17import static org.assertj.core.api.Assertions.assertThat;
18
19@Testcontainers
20class FtpUtilsTest {
21
22    private static final int PORT = 21;
23    private static final String USER = "user";
24    private static final String PASSWORD = "password";
25    private static final int FTP_TIMEOUT_IN_MILLISECONDS = 1000 * 60;
26
27    private static final GenericContainer ftp = new GenericContainer(
28        new ImageFromDockerfile()
29            .withDockerfileFromBuilder(builder ->
30                builder
31                    .from("delfer/alpine-ftp-server:latest")
32                    .build()
33            )
34    )
35        .withExposedPorts(PORT)
36        .withEnv("USERS", USER + "|" + PASSWORD);
37
38
39    @BeforeAll
40    public static void staticSetup() throws IOException {
41        ftp.start();
42    }
43
44    @AfterAll
45    static void afterAll() {
46        ftp.stop();
47    }
48
49    @Test
50    void test() throws IOException {
51        FTPClient ftpClient = new FTPClient();
52        ftpClient.setDataTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
53        ftpClient.setConnectTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
54        ftpClient.setDefaultTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
55
56        // Log
57        ftpClient.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out), true));
58
59        // Connect
60        try {
61            ftpClient.connect("localhost", ftp.getMappedPort(PORT));
62            ftpClient.setSoTimeout(FTP_TIMEOUT_IN_MILLISECONDS);
63
64            int reply = ftpClient.getReplyCode();
65            if (!FTPReply.isPositiveCompletion(reply)) {
66                ftpClient.disconnect();
67                throw new AssertionError();
68            }
69
70            // Login
71            boolean loginSuccess = ftpClient.login(USER, PASSWORD);
72            if (!loginSuccess) {
73                throw new AssertionError();
74            }
75
76            ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
77            ftpClient.enterLocalPassiveMode();
78
79        } catch (IOException e) {
80            throw new AssertionError(e);
81        }
82
83        String remoteFile = "fileonftp";
84        try (InputStream targetStream = new ByteArrayInputStream("Hello FTP".getBytes())) {
85            assertThat(ftpClient.isConnected()).isTrue();
86            ftpClient.storeFile(remoteFile, targetStream);
87        }
88    }
89}
90220 Welcome Alpine ftp server https://hub.docker.com/r/delfer/alpine-ftp-server/
91USER *******
92331 Please specify the password.
93PASS *******
94230 Login successful.
95TYPE I
96200 Switching to Binary mode.
97PASV
98227 Entering Passive Mode (172,17,0,3,82,15).
99[Replacing PASV mode reply address 172.17.0.3 with 127.0.0.1]
100Connection refused (Connection refused)
101java.net.ConnectException: Connection refused (Connection refused)
102    ...
103    at java.base/java.net.Socket.connect(Socket.java:609)
104    at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:866)
105    at org.apache.commons.net.ftp.FTPClient._storeFile(FTPClient.java:1053)
106    at org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:3816)
107    at org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:3846)
108Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [55600, 55601, 55602, 55603, 55604, 55605, 55606, 55607, 55608, 55609, 55598, 55599] should be listening)
109    private static final int PASSIVE_MODE_PORT = 21000;
110    ...
111    private static final FixedHostPortGenericContainer ftp = new FixedHostPortGenericContainer<>(
112            "delfer/alpine-ftp-server:latest")
113            .withFixedExposedPort(PASSIVE_MODE_PORT, PASSIVE_MODE_PORT)
114            .withExposedPorts(PORT)
115            .withEnv("USERS", USER + "|" + PASSWORD)
116            .withEnv("MIN_PORT", String.valueOf(PASSIVE_MODE_PORT))
117            .withEnv("MAX_PORT", String.valueOf(PASSIVE_MODE_PORT));
118    private static FixedHostPortGenericContainer ftp = new FixedHostPortGenericContainer<>(
119            "delfer/alpine-ftp-server:latest")
120            .withExposedPorts(PORT)
121            .withEnv("USERS", USER + "|" + PASSWORD);
122
123    @BeforeAll
124    public static void staticSetup() throws Exception {
125        Integer freePort = 0;
126        try (ServerSocket socket = new ServerSocket(0)) {
127            freePort = socket.getLocalPort();
128        }
129        ftp = (FixedHostPortGenericContainer)ftp.withFixedExposedPort(freePort, freePort)
130                .withEnv("MIN_PORT", String.valueOf(freePort))
131                .withEnv("MAX_PORT", String.valueOf(freePort));
132
133        ftp.start();
134    }
135

Source https://stackoverflow.com/questions/70274689

QUESTION

Can't install Python 3.10.0 with pyenv on MacOS

Asked 2021-Nov-18 at 18:37

Trying to install Python 3.10.0 on MacOS 11.6 (Intel) with pyenv 2.1.0 (from homebrew) fails with:

1python-build: use openssl@1.1 from homebrew
2python-build: use readline from homebrew
3Downloading Python-3.10.0.tar.xz...
4-> https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tar.xz
5Installing Python-3.10.0...
6python-build: use tcl-tk from homebrew
7python-build: use readline from homebrew
8python-build: use zlib from xcode sdk
9
10BUILD FAILED (OS X 11.6 using python-build 20180424)
11
12Inspect or clean up the working tree at /var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649
13Results logged to /var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649.log
14
15Last 10 log lines:
16checking MACHDEP... "darwin"
17checking for gcc... clang
18checking whether the C compiler works... yes
19checking for C compiler default output file name... a.out
20checking for suffix of executables... 
21checking whether we are cross compiling... configure: error: in `/var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649/Python-3.10.0':
22configure: error: cannot run C compiled programs.
23If you meant to cross compile, use `--host'.
24See `config.log' for more details
25make: *** No targets specified and no makefile found.  Stop.
26

The config.log in the build folder contains:

1python-build: use openssl@1.1 from homebrew
2python-build: use readline from homebrew
3Downloading Python-3.10.0.tar.xz...
4-> https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tar.xz
5Installing Python-3.10.0...
6python-build: use tcl-tk from homebrew
7python-build: use readline from homebrew
8python-build: use zlib from xcode sdk
9
10BUILD FAILED (OS X 11.6 using python-build 20180424)
11
12Inspect or clean up the working tree at /var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649
13Results logged to /var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649.log
14
15Last 10 log lines:
16checking MACHDEP... "darwin"
17checking for gcc... clang
18checking whether the C compiler works... yes
19checking for C compiler default output file name... a.out
20checking for suffix of executables... 
21checking whether we are cross compiling... configure: error: in `/var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649/Python-3.10.0':
22configure: error: cannot run C compiled programs.
23If you meant to cross compile, use `--host'.
24See `config.log' for more details
25make: *** No targets specified and no makefile found.  Stop.
26This file contains any messages produced by compilers while
27running configure, to aid debugging if configure makes a mistake.
28
29It was created by python configure 3.10, which was
30generated by GNU Autoconf 2.69.  Invocation command line was
31
32  $ ./configure --prefix=/Users/jonas.obrist/.pyenv/versions/3.10.0 --libdir=/Users/jonas.obrist/.pyenv/versions/3.10.0/lib --with-openssl=/usr/local/opt/openssl@1.1 --with-tcltk-libs=-L/usr/local/opt/tcl-tk/lib -ltcl8.6 -ltk8.6 --with-tcltk-includes=-I/usr/local/opt/tcl-tk/include
33
34## --------- ##
35## Platform. ##
36## --------- ##
37
38hostname = Jonas-MBP-2018.local
39uname -m = x86_64
40uname -r = 20.6.0
41uname -s = Darwin
42uname -v = Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64
43
44/usr/bin/uname -p = i386
45/bin/uname -X     = unknown
46
47/bin/arch              = unknown
48/usr/bin/arch -k       = unknown
49/usr/convex/getsysinfo = unknown
50/usr/bin/hostinfo      = Mach kernel version:
51     Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64
52Kernel configured for up to 12 processors.
536 processors are physically available.
5412 processors are logically available.
55Processor type: x86_64h (Intel x86-64h Haswell)
56Processors active: 0 1 2 3 4 5 6 7 8 9 10 11
57Primary memory available: 32.00 gigabytes
58Default processor set: 614 tasks, 3158 threads, 12 processors
59Load average: 2.13, Mach factor: 9.85
60/bin/machine           = unknown
61/usr/bin/oslevel       = unknown
62/bin/universe          = unknown
63
64PATH: /usr/local/Cellar/pyenv/HEAD-483d95d/libexec
65PATH: /usr/local/Cellar/pyenv/HEAD-483d95d/plugins/python-build/bin
66PATH: /Users/jonas.obrist/.poetry/bin
67PATH: /Users/jonas.obrist/.rbenv/shims
68PATH: /usr/local/opt/llvm/bin
69PATH: /usr/local/opt/libxml2/bin
70PATH: /Users/jonas.obrist/.poetry/bin/
71PATH: /Users/jonas.obrist/.cargo/bin
72PATH: /Users/jonas.obrist/.local/bin
73PATH: /Users/jonas.obrist/.fastlane/bin
74PATH: /Users/jonas.obrist/.gem/bin
75PATH: /Users/jonas.obrist/.pyenv/shims
76PATH: /Users/jonas.obrist/.pyenv/bin
77PATH: /usr/local/bin
78PATH: /usr/bin
79PATH: /bin
80PATH: /usr/sbin
81PATH: /sbin
82PATH: /Library/Apple/usr/bin
83PATH: /Users/jonas.obrist/go/bin
84
85
86## ----------- ##
87## Core tests. ##
88## ----------- ##
89
90configure:2878: checking build system type
91configure:2892: result: x86_64-apple-darwin20.6.0
92configure:2912: checking host system type
93configure:2925: result: x86_64-apple-darwin20.6.0
94configure:2955: checking for python3.10
95configure:2971: found /Users/jonas.obrist/.pyenv/shims/python3.10
96configure:2982: result: python3.10
97configure:3076: checking for --enable-universalsdk
98configure:3123: result: no
99configure:3147: checking for --with-universal-archs
100configure:3162: result: no
101configure:3318: checking MACHDEP
102configure:3369: result: "darwin"
103configure:3653: checking for gcc
104configure:3680: result: clang
105configure:3909: checking for C compiler version
106configure:3918: clang --version >&5
107Homebrew clang version 12.0.1
108Target: x86_64-apple-darwin20.6.0
109Thread model: posix
110InstalledDir: /usr/local/opt/llvm/bin
111configure:3929: $? = 0
112configure:3918: clang -v >&5
113Homebrew clang version 12.0.1
114Target: x86_64-apple-darwin20.6.0
115Thread model: posix
116InstalledDir: /usr/local/opt/llvm/bin
117configure:3929: $? = 0
118configure:3918: clang -V >&5
119clang-12: error: argument to '-V' is missing (expected 1 value)
120clang-12: error: no input files
121configure:3929: $? = 1
122configure:3918: clang -qversion >&5
123clang-12: error: unknown argument '-qversion'; did you mean '--version'?
124clang-12: error: no input files
125configure:3929: $? = 1
126configure:3949: checking whether the C compiler works
127configure:3971: clang -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include   -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib conftest.c  >&5
128ld: warning: directory not found for option '-L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib'
129configure:3975: $? = 0
130configure:4023: result: yes
131configure:4026: checking for C compiler default output file name
132configure:4028: result: a.out
133configure:4034: checking for suffix of executables
134configure:4041: clang -o conftest -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include   -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib conftest.c  >&5
135ld: warning: directory not found for option '-L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib'
136configure:4045: $? = 0
137configure:4067: result: 
138configure:4089: checking whether we are cross compiling
139configure:4097: clang -o conftest -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include   -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib conftest.c  >&5
140In file included from conftest.c:8:
141In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
142/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
143        unsigned char   *_base;
144                        ^
145/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: note: insert '_Nullable' if the pointer may be null
146        unsigned char   *_base;
147                        ^
148                          _Nullable 
149/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: note: insert '_Nonnull' if the pointer should never be null
150        unsigned char   *_base;
151                        ^
152                          _Nonnull 
153/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
154        int     (* _Nullable _read) (void *, char *, int);
155                                          ^
156/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:32: note: insert '_Nullable' if the pointer may be null
157        int     (* _Nullable _read) (void *, char *, int);
158                                          ^
159                                           _Nullable
160/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:32: note: insert '_Nonnull' if the pointer should never be null
161        int     (* _Nullable _read) (void *, char *, int);
162                                          ^
163                                           _Nonnull
164/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:40: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
165        int     (* _Nullable _read) (void *, char *, int);
166                                                  ^
167/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:40: note: insert '_Nullable' if the pointer may be null
168        int     (* _Nullable _read) (void *, char *, int);
169                                                  ^
170                                                   _Nullable
171/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:40: note: insert '_Nonnull' if the pointer should never be null
172        int     (* _Nullable _read) (void *, char *, int);
173                                                  ^
174                                                   _Nonnull
175/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:139:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
176        fpos_t  (* _Nullable _seek) (void *, fpos_t, int);
177                                          ^
178/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:139:35: note: insert '_Nullable' if the pointer may be null
179        fpos_t  (* _Nullable _seek) (void *, fpos_t, int);
180                                          ^
181                                           _Nullable
182/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:139:35: note: insert '_Nonnull' if the pointer should never be null
183        fpos_t  (* _Nullable _seek) (void *, fpos_t, int);
184                                          ^
185                                           _Nonnull
186/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
187        int     (* _Nullable _write)(void *, const char *, int);
188                                          ^
189/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:32: note: insert '_Nullable' if the pointer may be null
190        int     (* _Nullable _write)(void *, const char *, int);
191                                          ^
192                                           _Nullable
193/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:32: note: insert '_Nonnull' if the pointer should never be null
194        int     (* _Nullable _write)(void *, const char *, int);
195                                          ^
196                                           _Nonnull
197/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
198        int     (* _Nullable _write)(void *, const char *, int);
199                                                        ^
200/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:46: note: insert '_Nullable' if the pointer may be null
201        int     (* _Nullable _write)(void *, const char *, int);
202                                                        ^
203                                                         _Nullable
204/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:46: note: insert '_Nonnull' if the pointer should never be null
205        int     (* _Nullable _write)(void *, const char *, int);
206                                                        ^
207                                                         _Nonnull
208/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:144:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
209        struct __sFILEX *_extra; /* additions to FILE to not break ABI */
210                        ^
211/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:144:18: note: insert '_Nullable' if the pointer may be null
212        struct __sFILEX *_extra; /* additions to FILE to not break ABI */
213                        ^
214                          _Nullable 
215/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:144:18: note: insert '_Nonnull' if the pointer should never be null
216        struct __sFILEX *_extra; /* additions to FILE to not break ABI */
217                        ^
218                          _Nonnull 
219In file included from conftest.c:8:
220/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:220:5: error: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
221#if TARGET_OS_IPHONE
222    ^
223/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:67:13: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
224extern FILE *__stdinp;
225            ^
226/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:67:13: note: insert '_Nullable' if the pointer may be null
227extern FILE *__stdinp;
228            ^
229              _Nullable 
230/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:67:13: note: insert '_Nonnull' if the pointer should never be null
231extern FILE *__stdinp;
232            ^
233              _Nonnull 
234/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
235                 int (* _Nullable)(void *, const char *, int),
236                                        ^
237/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:41: note: insert '_Nullable' if the pointer may be null
238                 int (* _Nullable)(void *, const char *, int),
239                                        ^
240                                         _Nullable
241/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:41: note: insert '_Nonnull' if the pointer should never be null
242                 int (* _Nullable)(void *, const char *, int),
243                                        ^
244                                         _Nonnull
245/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:55: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
246                 int (* _Nullable)(void *, const char *, int),
247                                                      ^
248/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:55: note: insert '_Nullable' if the pointer may be null
249                 int (* _Nullable)(void *, const char *, int),
250                                                      ^
251                                                       _Nullable
252/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:55: note: insert '_Nonnull' if the pointer should never be null
253                 int (* _Nullable)(void *, const char *, int),
254                                                      ^
255                                                       _Nonnull
256/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:387:44: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
257                 fpos_t (* _Nullable)(void *, fpos_t, int),
258                                           ^
259/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:387:44: note: insert '_Nullable' if the pointer may be null
260                 fpos_t (* _Nullable)(void *, fpos_t, int),
261                                           ^
262                                            _Nullable
263/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:387:44: note: insert '_Nonnull' if the pointer should never be null
264                 fpos_t (* _Nullable)(void *, fpos_t, int),
265                                           ^
266                                            _Nonnull
267/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:388:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
268                 int (* _Nullable)(void *));
269                                        ^
270/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:388:41: note: insert '_Nullable' if the pointer may be null
271                 int (* _Nullable)(void *));
272                                        ^
273                                         _Nullable
274/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:388:41: note: insert '_Nonnull' if the pointer should never be null
275                 int (* _Nullable)(void *));
276                                        ^
277                                         _Nonnull
278/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:384:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
279FILE    *funopen(const void *,
280        ^
281/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:384:6: note: insert '_Nullable' if the pointer may be null
282FILE    *funopen(const void *,
283        ^
284          _Nullable 
285/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:384:6: note: insert '_Nonnull' if the pointer should never be null
286FILE    *funopen(const void *,
287        ^
288          _Nonnull 
28913 warnings and 1 error generated.
290configure:4101: $? = 1
291configure:4108: ./conftest
292./configure: line 4110: ./conftest: No such file or directory
293configure:4112: $? = 127
294configure:4119: error: in `/var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649/Python-3.10.0':
295configure:4121: error: cannot run C compiled programs.
296If you meant to cross compile, use `--host'.
297See `config.log' for more details
298
299## ---------------- ##
300## Cache variables. ##
301## ---------------- ##
302
303ac_cv_build=x86_64-apple-darwin20.6.0
304ac_cv_env_CC_set=set
305ac_cv_env_CC_value=clang
306ac_cv_env_CFLAGS_set=set
307ac_cv_env_CFLAGS_value='-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include  '
308ac_cv_env_CPPFLAGS_set=set
309ac_cv_env_CPPFLAGS_value='-I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include'
310ac_cv_env_CPP_set=
311ac_cv_env_CPP_value=
312ac_cv_env_LDFLAGS_set=set
313ac_cv_env_LDFLAGS_value='-L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib'
314ac_cv_env_LIBS_set=
315ac_cv_env_LIBS_value=
316ac_cv_env_MACHDEP_set=
317ac_cv_env_MACHDEP_value=
318ac_cv_env_PROFILE_TASK_set=
319ac_cv_env_PROFILE_TASK_value=
320ac_cv_env_build_alias_set=
321ac_cv_env_build_alias_value=
322ac_cv_env_host_alias_set=
323ac_cv_env_host_alias_value=
324ac_cv_env_target_alias_set=
325ac_cv_env_target_alias_value=
326ac_cv_host=x86_64-apple-darwin20.6.0
327ac_cv_prog_PYTHON_FOR_REGEN=python3.10
328ac_cv_prog_ac_ct_CC=clang
329
330## ----------------- ##
331## Output variables. ##
332## ----------------- ##
333
334ABIFLAGS=''
335ALT_SOABI=''
336AR=''
337ARCH_RUN_32BIT=''
338ARFLAGS=''
339BASECFLAGS=''
340BASECPPFLAGS=''
341BINLIBDEST=''
342BLDLIBRARY=''
343BLDSHARED=''
344BUILDEXEEXT=''
345CC='clang'
346CCSHARED=''
347CFLAGS='-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include  '
348CFLAGSFORSHARED=''
349CFLAGS_ALIASING=''
350CFLAGS_NODIST=''
351CONFIGURE_MACOSX_DEPLOYMENT_TARGET=''
352CONFIG_ARGS=' '\''--prefix=/Users/jonas.obrist/.pyenv/versions/3.10.0'\'' '\''--libdir=/Users/jonas.obrist/.pyenv/versions/3.10.0/lib'\'' '\''--with-openssl=/usr/local/opt/openssl@1.1'\'' '\''--with-tcltk-libs=-L/usr/local/opt/tcl-tk/lib -ltcl8.6 -ltk8.6'\'' '\''--with-tcltk-includes=-I/usr/local/opt/tcl-tk/include'\'' '\''CC=clang'\'' '\''CFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include  '\'' '\''LDFLAGS=-L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib'\'' '\''CPPFLAGS=-I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include'\'''
353CPP=''
354CPPFLAGS='-I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include'
355CXX=''
356DEFS=''
357DEF_MAKE_ALL_RULE=''
358DEF_MAKE_RULE=''
359DFLAGS=''
360DLINCLDIR=''
361DLLLIBRARY=''
362DTRACE=''
363DTRACE_HEADERS=''
364DTRACE_OBJS=''
365DYNLOADFILE=''
366ECHO_C='\c'
367ECHO_N=''
368ECHO_T=''
369EGREP=''
370ENSUREPIP=''
371EXEEXT=''
372EXPORTSFROM=''
373EXPORTSYMS=''
374EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
375EXT_SUFFIX=''
376FRAMEWORKALTINSTALLFIRST=''
377FRAMEWORKALTINSTALLLAST=''
378FRAMEWORKINSTALLAPPSPREFIX=''
379FRAMEWORKINSTALLFIRST=''
380FRAMEWORKINSTALLLAST=''
381FRAMEWORKPYTHONW=''
382FRAMEWORKUNIXTOOLSPREFIX='/Users/jonas.obrist/.pyenv/versions/3.10.0'
383GITBRANCH=''
384GITTAG=''
385GITVERSION=''
386GNULD=''
387GREP=''
388HAS_GIT='no-repository'
389HAVE_GETHOSTBYNAME=''
390HAVE_GETHOSTBYNAME_R=''
391HAVE_GETHOSTBYNAME_R_3_ARG=''
392HAVE_GETHOSTBYNAME_R_5_ARG=''
393HAVE_GETHOSTBYNAME_R_6_ARG=''
394INSTALL_DATA=''
395INSTALL_PROGRAM=''
396INSTALL_SCRIPT=''
397INSTSONAME=''
398LDCXXSHARED=''
399LDFLAGS='-L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib'
400LDFLAGS_NODIST=''
401LDLIBRARY=''
402LDLIBRARYDIR=''
403LDSHARED=''
404LDVERSION=''
405LIBC=''
406LIBFFI_INCLUDEDIR=''
407LIBM=''
408LIBOBJS=''
409LIBPL=''
410LIBPYTHON=''
411LIBRARY=''
412LIBRARY_DEPS=''
413LIBS=''
414LIBTOOL_CRUFT=''
415LINKCC=''
416LINKFORSHARED=''
417LIPO_32BIT_FLAGS=''
418LIPO_INTEL64_FLAGS=''
419LLVM_AR=''
420LLVM_AR_FOUND=''
421LLVM_PROFDATA=''
422LLVM_PROF_ERR=''
423LLVM_PROF_FILE=''
424LLVM_PROF_FOUND=''
425LLVM_PROF_MERGER=''
426LN=''
427LTLIBOBJS=''
428MACHDEP='darwin'
429MACHDEP_OBJS=''
430MAINCC=''
431MKDIR_P=''
432MULTIARCH=''
433MULTIARCH_CPPFLAGS=''
434NO_AS_NEEDED=''
435OBJEXT=''
436OPENSSL_INCLUDES=''
437OPENSSL_LDFLAGS=''
438OPENSSL_LIBS=''
439OPENSSL_RPATH=''
440OPT=''
441OTHER_LIBTOOL_OPT=''
442PACKAGE_BUGREPORT='https://bugs.python.org/'
443PACKAGE_NAME='python'
444PACKAGE_STRING='python 3.10'
445PACKAGE_TARNAME='python'
446PACKAGE_URL=''
447PACKAGE_VERSION='3.10'
448PATH_SEPARATOR=':'
449PGO_PROF_GEN_FLAG=''
450PGO_PROF_USE_FLAG=''
451PKG_CONFIG=''
452PLATFORM_TRIPLET=''
453PLATLIBDIR=''
454PROFILE_TASK=''
455PY3LIBRARY=''
456PYTHONFRAMEWORK=''
457PYTHONFRAMEWORKDIR='no-framework'
458PYTHONFRAMEWORKIDENTIFIER='org.python.python'
459PYTHONFRAMEWORKINSTALLDIR=''
460PYTHONFRAMEWORKPREFIX=''
461PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
462PYTHON_FOR_REGEN='python3.10'
463PY_ENABLE_SHARED=''
464READELF=''
465RUNSHARED=''
466SED=''
467SHELL='/bin/sh'
468SHLIBS=''
469SHLIB_SUFFIX=''
470SOABI=''
471SOVERSION='1.0'
472SRCDIRS=''
473STATIC_LIBPYTHON=''
474TCLTK_INCLUDES=''
475TCLTK_LIBS=''
476TEST_MODULES=''
477THREADHEADERS=''
478TRUE=''
479TZPATH=''
480UNIVERSALSDK=''
481UNIVERSAL_ARCH_FLAGS=''
482VERSION='3.10'
483WHEEL_PKG_DIR=''
484_PYTHON_HOST_PLATFORM=''
485ac_ct_AR=''
486ac_ct_CC='clang'
487ac_ct_CXX=''
488ac_ct_READELF=''
489bindir='${exec_prefix}/bin'
490build='x86_64-apple-darwin20.6.0'
491build_alias=''
492build_cpu='x86_64'
493build_os='darwin20.6.0'
494build_vendor='apple'
495datadir='${datarootdir}'
496datarootdir='${prefix}/share'
497docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
498dvidir='${docdir}'
499exec_prefix='NONE'
500host='x86_64-apple-darwin20.6.0'
501host_alias=''
502host_cpu='x86_64'
503host_os='darwin20.6.0'
504host_vendor='apple'
505htmldir='${docdir}'
506includedir='${prefix}/include'
507infodir='${datarootdir}/info'
508libdir='/Users/jonas.obrist/.pyenv/versions/3.10.0/lib'
509libexecdir='${exec_prefix}/libexec'
510localedir='${datarootdir}/locale'
511localstatedir='${prefix}/var'
512mandir='${datarootdir}/man'
513oldincludedir='/usr/include'
514pdfdir='${docdir}'
515prefix='/Users/jonas.obrist/.pyenv/versions/3.10.0'
516program_transform_name='s,x,x,'
517psdir='${docdir}'
518runstatedir='${localstatedir}/run'
519sbindir='${exec_prefix}/sbin'
520sharedstatedir='${prefix}/com'
521sysconfdir='${prefix}/etc'
522target_alias=''
523
524## ----------- ##
525## confdefs.h. ##
526## ----------- ##
527
528/* confdefs.h */
529#define _GNU_SOURCE 1
530#define _NETBSD_SOURCE 1
531#define __BSD_VISIBLE 1
532#define _DARWIN_C_SOURCE 1
533#define _PYTHONFRAMEWORK ""
534
535configure: exit 1
536

I am able to build it manually by downloading the tarball and ./configure && make

How can I get it to install?

ANSWER

Answered 2021-Oct-06 at 05:56

Try env ARCHFLAGS="-arch x86_64"

(that works for me for other Python-related tools, I don't use pyenv myself).

Rationale: modern macOS supports 2 architectures: intel (x86_64) and m1 (arm-something). Compiling for only one architecture is easier.

Source https://stackoverflow.com/questions/69459268

QUESTION

Unable to install pgAdmin 4 in ubuntu 21.10

Asked 2021-Nov-16 at 12:43

I am facing some issues when I tried to install pgAdmin4 in the latest ubuntu version 21.10.

I have Installed the public key for the repository using following command

1sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
2

But when I tried to create the repository configuration file using the following command I am getting an error mentioned below.

1sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
2sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
3

ERROR LOG

1sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
2sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
3  404  Not Found [IP: 2604:1380:2000:7501::69 443]
4Hit:11 http://us.archive.ubuntu.com/ubuntu impish-backports InRelease
5Get:12 http://us.archive.ubuntu.com/ubuntu impish-updates/main amd64 DEP-11 Metadata [7,972 B]
6Get:13 http://us.archive.ubuntu.com/ubuntu impish-updates/universe amd64 DEP-11 Metadata [2,008 B]
7Reading package lists... Done       
8E: The repository 'https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/impish pgadmin4 Release' does not have a Release file.
9N: Updating from such a repository can't be done securely, and is therefore disabled by default.
10N: See apt-secure(8) manpage for repository creation and user configuration details.
11

Alternative application name: dbeaver
Alternative application link: https://dbeaver.io/download/ Thank you.

ANSWER

Answered 2021-Nov-16 at 12:43

Try with hirsute :

1sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
2sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
3  404  Not Found [IP: 2604:1380:2000:7501::69 443]
4Hit:11 http://us.archive.ubuntu.com/ubuntu impish-backports InRelease
5Get:12 http://us.archive.ubuntu.com/ubuntu impish-updates/main amd64 DEP-11 Metadata [7,972 B]
6Get:13 http://us.archive.ubuntu.com/ubuntu impish-updates/universe amd64 DEP-11 Metadata [2,008 B]
7Reading package lists... Done       
8E: The repository 'https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/impish pgadmin4 Release' does not have a Release file.
9N: Updating from such a repository can't be done securely, and is therefore disabled by default.
10N: See apt-secure(8) manpage for repository creation and user configuration details.
11sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/hirsute pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
12

Source https://stackoverflow.com/questions/69773217

QUESTION

"The format of the URI could not be determined" when combining absolute and relative URLs in C#

Asked 2021-Nov-09 at 09:24

I have a script that accesses an FTP server, and gets a list of files under a directory:

1//line 65 of Status script that is mentioned in error message
2string[] list = ftp.DirectoryListSimple("AdvancedCalender/Calenders/Versions");
3
1//line 65 of Status script that is mentioned in error message
2string[] list = ftp.DirectoryListSimple("AdvancedCalender/Calenders/Versions");
3//ftp.DirectoryListSimple()
4//FTP script that is mentioned in error message
5public string[] DirectoryListSimple(string directory)
6{
7    try
8    {
9        Uri serverUri = new Uri(host);
10        Uri relativeUri = new Uri("/" + directory);
11        Uri fullUri = new Uri(serverUri, relativeUri);
12        ftpRequest = (FtpWebRequest)FtpWebRequest.Create(fullUri);
13
14        ftpRequest.Credentials = new NetworkCredential(user, pass);
15
16        ftpRequest.UseBinary = true;
17        ftpRequest.UsePassive = true;
18        ftpRequest.KeepAlive = true;
19
20        ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory;
21
22        ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
23
24        ftpStream = ftpResponse.GetResponseStream();
25
26        StreamReader ftpReader = new StreamReader(ftpStream);
27
28        string directoryRaw = null;
29
30        try { while (ftpReader.Peek() != -1) { directoryRaw += ftpReader.ReadLine() + "|"; } }
31        catch (Exception ex) { Debug.LogError(ex.ToString()); }
32
33        ftpReader.Close();
34        ftpStream.Close();
35        ftpResponse.Close();
36        ftpRequest = null;
37
38        try { string[] directoryList = directoryRaw.Split("|".ToCharArray()); return directoryList; }
39        catch (Exception ex) { Debug.LogError(ex.ToString()); }
40    }
41    catch (Exception ex) { Debug.LogError(ex.ToString()); }
42    //^ error caught here
43    return new string[] { "" };
44}
45

Error message:

System.UriFormatException: Invalid URI: The format of the URI could not be determined. at System.Uri.CreateThis (System.String uri, System.Boolean dontEscape, System.UriKind uriKind) [0x0007b] in :0 at System.Uri..ctor (System.String uriString) [0x00014] in :0 at BtStudios.HelperClasses.FtpHelpers.FTP.DirectoryListSimple (System.String directory) [0x0000b] in C:\Users\btowr\OneDrive\Desktop\Advanced Calender\Assets\FTP.cs:299 UnityEngine.Debug:LogError (object) BtStudios.HelperClasses.FtpHelpers.FTP:DirectoryListSimple (string) (at Assets/FTP.cs:330) Status:Start () (at Assets/Status.cs:65)

I can confirm that I can connect to the FTP server, I can confirm that the files exist, and I can confirm that the URI format is correct (at least that I know of).

(EDIT) If you need to see a variable that is used in the function, I can share it, but sensitive information, such as the ip, username and password will not be the same as the real ip username and password.

ANSWER

Answered 2021-Nov-08 at 08:28

The "/AdvancedCalender/Calenders/Versions" is a relative URI, so you need to tag is like that:

1//line 65 of Status script that is mentioned in error message
2string[] list = ftp.DirectoryListSimple("AdvancedCalender/Calenders/Versions");
3//ftp.DirectoryListSimple()
4//FTP script that is mentioned in error message
5public string[] DirectoryListSimple(string directory)
6{
7    try
8    {
9        Uri serverUri = new Uri(host);
10        Uri relativeUri = new Uri("/" + directory);
11        Uri fullUri = new Uri(serverUri, relativeUri);
12        ftpRequest = (FtpWebRequest)FtpWebRequest.Create(fullUri);
13
14        ftpRequest.Credentials = new NetworkCredential(user, pass);
15
16        ftpRequest.UseBinary = true;
17        ftpRequest.UsePassive = true;
18        ftpRequest.KeepAlive = true;
19
20        ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory;
21
22        ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
23
24        ftpStream = ftpResponse.GetResponseStream();
25
26        StreamReader ftpReader = new StreamReader(ftpStream);
27
28        string directoryRaw = null;
29
30        try { while (ftpReader.Peek() != -1) { directoryRaw += ftpReader.ReadLine() + "|"; } }
31        catch (Exception ex) { Debug.LogError(ex.ToString()); }
32
33        ftpReader.Close();
34        ftpStream.Close();
35        ftpResponse.Close();
36        ftpRequest = null;
37
38        try { string[] directoryList = directoryRaw.Split("|".ToCharArray()); return directoryList; }
39        catch (Exception ex) { Debug.LogError(ex.ToString()); }
40    }
41    catch (Exception ex) { Debug.LogError(ex.ToString()); }
42    //^ error caught here
43    return new string[] { "" };
44}
45Uri relativeUri = new Uri("/" + directory, UriKind.Relative);
46

Source https://stackoverflow.com/questions/69858671

QUESTION

Compiling python 3.10 at Amazon Linux 2

Asked 2021-Oct-24 at 13:32

I'm trying to compile and install Python 3.10 into a Amazon Linux 2 but I'm not being able to get it with https support. Here the commands that I'm using to compile it:

1sudo yum -y update
2sudo yum -y groupinstall "Development Tools"
3sudo yum -y install openssl-devel bzip2-devel libffi-devel
4
5wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
6tar xzf Python-3.10.0.tgz
7cd Python-3.10.0
8
9sudo ./configure --enable-optimizations
10sudo make altinstall
11

The binary works, but when I try to use it with for reach an https endpoint, I get this message:

1sudo yum -y update
2sudo yum -y groupinstall "Development Tools"
3sudo yum -y install openssl-devel bzip2-devel libffi-devel
4
5wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
6tar xzf Python-3.10.0.tgz
7cd Python-3.10.0
8
9sudo ./configure --enable-optimizations
10sudo make altinstall
11Traceback (most recent call last):
12  File "<stdin>", line 1113, in <module>
13  File "<stdin>", line 1087, in main
14  File "/usr/local/lib/python3.10/urllib/request.py", line 216, in urlopen
15    return opener.open(url, data, timeout)
16  File "/usr/local/lib/python3.10/urllib/request.py", line 519, in open
17    response = self._open(req, data)
18  File "/usr/local/lib/python3.10/urllib/request.py", line 541, in _open
19    return self._call_chain(self.handle_open, 'unknown',
20  File "/usr/local/lib/python3.10/urllib/request.py", line 496, in _call_chain
21    result = func(*args)
22  File "/usr/local/lib/python3.10/urllib/request.py", line 1419, in unknown_open
23    raise URLError('unknown url type: %s' % type)
24urllib.error.URLError: <urlopen error unknown url type: https>
25

I'm not sure what I'm missing :/

ANSWER

Answered 2021-Oct-24 at 08:34

From Python3.10, OpenSSL 1.1.1 or newer is required.

(Ref: PEP 644, Python3.10 release)

I have tried changing some of your code like below and worked.

delete: openssl-devel

add: openssl11 openssl11-devel.

Source https://stackoverflow.com/questions/69692703

QUESTION

Adding imagemagick into my php 7.4 docker raised error

Asked 2021-Oct-11 at 07:29

I need to add imagemagick into my php 7.4 docker, so in file Dockerfile.yml I added :

1FROM php:7.4.1-apache
2
3RUN apt-get update && \
4    apt-get install -y \
5        python \
6        libfreetype6-dev \
7        libwebp-dev \
8        libjpeg62-turbo-dev \
9        libpng-dev \
10        libzip-dev \
11        nano \
12        mc \
13        git-core \    
14        libmagickwand-dev --no-install-recommends && \
15    pecl install imagick && imagick && \
16    docker-php-ext-enable imagick && \
17    curl ...
18    
19RUN docker-php-ext-install \
20        gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif && \
21    a2enmod rewrite
22
23RUN install-php-extensions imagick
24    
25COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
26

But I got error:

1FROM php:7.4.1-apache
2
3RUN apt-get update && \
4    apt-get install -y \
5        python \
6        libfreetype6-dev \
7        libwebp-dev \
8        libjpeg62-turbo-dev \
9        libpng-dev \
10        libzip-dev \
11        nano \
12        mc \
13        git-core \    
14        libmagickwand-dev --no-install-recommends && \
15    pecl install imagick && imagick && \
16    docker-php-ext-enable imagick && \
17    curl ...
18    
19RUN docker-php-ext-install \
20        gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif && \
21    a2enmod rewrite
22
23RUN install-php-extensions imagick
24    
25COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
26Build process completed successfully
27Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so'
28Installing '/usr/local/include/php/ext/imagick/php_imagick_shared.h'
29install ok: channel://pecl.php.net/imagick-3.5.1
30configuration option "php_ini" is not set to php.ini location
31You should add "extension=imagick.so" to php.ini
32/bin/sh: 1: imagick: not found
33ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update &&     apt-get install -y     python     libfreetype6-dev     libwebp-dev     libjpeg62-turbo-dev     libpng-dev     libzip-dev     nano     mc     git-core     libmagickwand-dev --no-install-recommends &&     pecl install imagick && imagick &&     docker-php-ext-enable imagick &&     curl     build-essential     openssl     libssl-dev     libgmp-dev     libldap2-dev     netcat     locate     && git clone https://github.com/nodejs/node.git &&     cd node      && git checkout v12.0.0     && ./configure     && make     && make install' returned a non-zero code: 127
34

What is wrong in my Dockerfile.yml and how can it be fixed ?

UPDATED # 2: I modified Dockerfile.yml :

1FROM php:7.4.1-apache
2
3RUN apt-get update && \
4    apt-get install -y \
5        python \
6        libfreetype6-dev \
7        libwebp-dev \
8        libjpeg62-turbo-dev \
9        libpng-dev \
10        libzip-dev \
11        nano \
12        mc \
13        git-core \    
14        libmagickwand-dev --no-install-recommends && \
15    pecl install imagick && imagick && \
16    docker-php-ext-enable imagick && \
17    curl ...
18    
19RUN docker-php-ext-install \
20        gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif && \
21    a2enmod rewrite
22
23RUN install-php-extensions imagick
24    
25COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
26Build process completed successfully
27Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so'
28Installing '/usr/local/include/php/ext/imagick/php_imagick_shared.h'
29install ok: channel://pecl.php.net/imagick-3.5.1
30configuration option "php_ini" is not set to php.ini location
31You should add "extension=imagick.so" to php.ini
32/bin/sh: 1: imagick: not found
33ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update &&     apt-get install -y     python     libfreetype6-dev     libwebp-dev     libjpeg62-turbo-dev     libpng-dev     libzip-dev     nano     mc     git-core     libmagickwand-dev --no-install-recommends &&     pecl install imagick && imagick &&     docker-php-ext-enable imagick &&     curl     build-essential     openssl     libssl-dev     libgmp-dev     libldap2-dev     netcat     locate     && git clone https://github.com/nodejs/node.git &&     cd node      && git checkout v12.0.0     && ./configure     && make     && make install' returned a non-zero code: 127
34  FROM php:7.4.1-apache
35    RUN apt-get update && \
36#    apt-get install -y \
37    apt-get install --assume-yes --no-install-recommends --quiet \
38    python \
39    libfreetype6-dev \
40    libwebp-dev \
41    libjpeg62-turbo-dev \
42    libpng-dev \
43    libzip-dev \
44    nano \
45    mc \
46    git-core \
47    libmagickwand-dev \
48    curl \
49    build-essential \
50    openssl \
51    libssl-dev \
52    libgmp-dev \
53    libldap2-dev \
54    netcat \
55    locate \
56    # composer \
57    && git clone https://github.com/nodejs/node.git && \
58    cd node  \
59    && git checkout v12.0.0 \
60    && ./configure \
61    && make \
62    && make install
63
64  RUN pecl install imagick \
65    && docker-php-ext-enable imagick
66
67    RUN npm install cross-env
68
69    RUN npm install -g yarn
70
71    # RUN  docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/
72    RUN docker-php-ext-configure gd --with-freetype --with-jpeg
73    # READ https://github.com/docker-library/php/issues/912#issuecomment-559918036
74
75
76    # Install Composer
77    RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
78
79    RUN  docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif  \
80    && a2enmod rewrite
81
82    RUN apt-get install -y grep mlocate
83
84    RUN docker-php-ext-install imagick
85
86    COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
87

But running :

1FROM php:7.4.1-apache
2
3RUN apt-get update && \
4    apt-get install -y \
5        python \
6        libfreetype6-dev \
7        libwebp-dev \
8        libjpeg62-turbo-dev \
9        libpng-dev \
10        libzip-dev \
11        nano \
12        mc \
13        git-core \    
14        libmagickwand-dev --no-install-recommends && \
15    pecl install imagick && imagick && \
16    docker-php-ext-enable imagick && \
17    curl ...
18    
19RUN docker-php-ext-install \
20        gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif && \
21    a2enmod rewrite
22
23RUN install-php-extensions imagick
24    
25COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
26Build process completed successfully
27Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so'
28Installing '/usr/local/include/php/ext/imagick/php_imagick_shared.h'
29install ok: channel://pecl.php.net/imagick-3.5.1
30configuration option "php_ini" is not set to php.ini location
31You should add "extension=imagick.so" to php.ini
32/bin/sh: 1: imagick: not found
33ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update &&     apt-get install -y     python     libfreetype6-dev     libwebp-dev     libjpeg62-turbo-dev     libpng-dev     libzip-dev     nano     mc     git-core     libmagickwand-dev --no-install-recommends &&     pecl install imagick && imagick &&     docker-php-ext-enable imagick &&     curl     build-essential     openssl     libssl-dev     libgmp-dev     libldap2-dev     netcat     locate     && git clone https://github.com/nodejs/node.git &&     cd node      && git checkout v12.0.0     && ./configure     && make     && make install' returned a non-zero code: 127
34  FROM php:7.4.1-apache
35    RUN apt-get update && \
36#    apt-get install -y \
37    apt-get install --assume-yes --no-install-recommends --quiet \
38    python \
39    libfreetype6-dev \
40    libwebp-dev \
41    libjpeg62-turbo-dev \
42    libpng-dev \
43    libzip-dev \
44    nano \
45    mc \
46    git-core \
47    libmagickwand-dev \
48    curl \
49    build-essential \
50    openssl \
51    libssl-dev \
52    libgmp-dev \
53    libldap2-dev \
54    netcat \
55    locate \
56    # composer \
57    && git clone https://github.com/nodejs/node.git && \
58    cd node  \
59    && git checkout v12.0.0 \
60    && ./configure \
61    && make \
62    && make install
63
64  RUN pecl install imagick \
65    && docker-php-ext-enable imagick
66
67    RUN npm install cross-env
68
69    RUN npm install -g yarn
70
71    # RUN  docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/
72    RUN docker-php-ext-configure gd --with-freetype --with-jpeg
73    # READ https://github.com/docker-library/php/issues/912#issuecomment-559918036
74
75
76    # Install Composer
77    RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
78
79    RUN  docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif  \
80    && a2enmod rewrite
81
82    RUN apt-get install -y grep mlocate
83
84    RUN docker-php-ext-install imagick
85
86    COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
87docker-compose up -d --build
88

I got erros in output :

1FROM php:7.4.1-apache
2
3RUN apt-get update && \
4    apt-get install -y \
5        python \
6        libfreetype6-dev \
7        libwebp-dev \
8        libjpeg62-turbo-dev \
9        libpng-dev \
10        libzip-dev \
11        nano \
12        mc \
13        git-core \    
14        libmagickwand-dev --no-install-recommends && \
15    pecl install imagick && imagick && \
16    docker-php-ext-enable imagick && \
17    curl ...
18    
19RUN docker-php-ext-install \
20        gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif && \
21    a2enmod rewrite
22
23RUN install-php-extensions imagick
24    
25COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
26Build process completed successfully
27Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so'
28Installing '/usr/local/include/php/ext/imagick/php_imagick_shared.h'
29install ok: channel://pecl.php.net/imagick-3.5.1
30configuration option "php_ini" is not set to php.ini location
31You should add "extension=imagick.so" to php.ini
32/bin/sh: 1: imagick: not found
33ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update &&     apt-get install -y     python     libfreetype6-dev     libwebp-dev     libjpeg62-turbo-dev     libpng-dev     libzip-dev     nano     mc     git-core     libmagickwand-dev --no-install-recommends &&     pecl install imagick && imagick &&     docker-php-ext-enable imagick &&     curl     build-essential     openssl     libssl-dev     libgmp-dev     libldap2-dev     netcat     locate     && git clone https://github.com/nodejs/node.git &&     cd node      && git checkout v12.0.0     && ./configure     && make     && make install' returned a non-zero code: 127
34  FROM php:7.4.1-apache
35    RUN apt-get update && \
36#    apt-get install -y \
37    apt-get install --assume-yes --no-install-recommends --quiet \
38    python \
39    libfreetype6-dev \
40    libwebp-dev \
41    libjpeg62-turbo-dev \
42    libpng-dev \
43    libzip-dev \
44    nano \
45    mc \
46    git-core \
47    libmagickwand-dev \
48    curl \
49    build-essential \
50    openssl \
51    libssl-dev \
52    libgmp-dev \
53    libldap2-dev \
54    netcat \
55    locate \
56    # composer \
57    && git clone https://github.com/nodejs/node.git && \
58    cd node  \
59    && git checkout v12.0.0 \
60    && ./configure \
61    && make \
62    && make install
63
64  RUN pecl install imagick \
65    && docker-php-ext-enable imagick
66
67    RUN npm install cross-env
68
69    RUN npm install -g yarn
70
71    # RUN  docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/
72    RUN docker-php-ext-configure gd --with-freetype --with-jpeg
73    # READ https://github.com/docker-library/php/issues/912#issuecomment-559918036
74
75
76    # Install Composer
77    RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
78
79    RUN  docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif  \
80    && a2enmod rewrite
81
82    RUN apt-get install -y grep mlocate
83
84    RUN docker-php-ext-install imagick
85
86    COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
87docker-compose up -d --build
88Need to get 97.7 kB of archives.
89After this operation, 504 kB of additional disk space will be used.
90Get:1 http://deb.debian.org/debian buster/main amd64 mlocate amd64 0.26-3 [97.7 kB]
91debconf: delaying package configuration, since apt-utils is not installed
92Fetched 97.7 kB in 0s (729 kB/s)
93Selecting previously unselected package mlocate.
94(Reading database ... 22379 files and directories currently installed.)
95Preparing to unpack .../mlocate_0.26-3_amd64.deb ...
96Unpacking mlocate (0.26-3) ...
97Setting up mlocate (0.26-3) ...
98update-alternatives: using /usr/bin/mlocate to provide /usr/bin/locate (locate) in auto mode
99update-alternatives: warning: skip creation of /usr/share/man/man1/locate.1.gz because associated file /usr/share/man/man1/mlocate.1.gz (of link group locate) doesn't exist
100update-alternatives: warning: skip creation of /usr/share/man/man8/updatedb.8.gz because associated file /usr/share/man/man8/updatedb.mlocate.8.gz (of link group locate) doesn't exist
101Adding group `mlocate' (GID 101) ...
102Done.
103Removing intermediate container 40f86f34f2af
104 ---> edaee648df84
105Step 10/11 : RUN docker-php-ext-install imagick
106 ---> Running in a72d0887a6b0
107error: /usr/src/php/ext/imagick does not exist
108
109usage: /usr/local/bin/docker-php-ext-install [-jN] ext-name [ext-name ...]
110   ie: /usr/local/bin/docker-php-ext-install gd mysqli
111       /usr/local/bin/docker-php-ext-install pdo pdo_mysql
112       /usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop
113
114if custom ./configure arguments are necessary, see docker-php-ext-configure
115
116Possible values for ext-name:
117bcmath bz2 calendar ctype curl dba dom enchant exif ffi fileinfo filter ftp gd gettext gmp hash iconv imap intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlrpc xmlwriter xsl zend_test zip
118
119Some of the above modules are already compiled into PHP; please check
120the output of "php -i" to see which modules are already loaded.
121ERROR: Service 'web' failed to build: The command '/bin/sh -c docker-php-ext-install imagick' returned a non-zero code: 1
122

How can I fix it ?

Thanks in advance!

ANSWER

Answered 2021-Oct-11 at 07:29

The message

1FROM php:7.4.1-apache
2
3RUN apt-get update && \
4    apt-get install -y \
5        python \
6        libfreetype6-dev \
7        libwebp-dev \
8        libjpeg62-turbo-dev \
9        libpng-dev \
10        libzip-dev \
11        nano \
12        mc \
13        git-core \    
14        libmagickwand-dev --no-install-recommends && \
15    pecl install imagick && imagick && \
16    docker-php-ext-enable imagick && \
17    curl ...
18    
19RUN docker-php-ext-install \
20        gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif && \
21    a2enmod rewrite
22
23RUN install-php-extensions imagick
24    
25COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
26Build process completed successfully
27Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so'
28Installing '/usr/local/include/php/ext/imagick/php_imagick_shared.h'
29install ok: channel://pecl.php.net/imagick-3.5.1
30configuration option "php_ini" is not set to php.ini location
31You should add "extension=imagick.so" to php.ini
32/bin/sh: 1: imagick: not found
33ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update &&     apt-get install -y     python     libfreetype6-dev     libwebp-dev     libjpeg62-turbo-dev     libpng-dev     libzip-dev     nano     mc     git-core     libmagickwand-dev --no-install-recommends &&     pecl install imagick && imagick &&     docker-php-ext-enable imagick &&     curl     build-essential     openssl     libssl-dev     libgmp-dev     libldap2-dev     netcat     locate     && git clone https://github.com/nodejs/node.git &&     cd node      && git checkout v12.0.0     && ./configure     && make     && make install' returned a non-zero code: 127
34  FROM php:7.4.1-apache
35    RUN apt-get update && \
36#    apt-get install -y \
37    apt-get install --assume-yes --no-install-recommends --quiet \
38    python \
39    libfreetype6-dev \
40    libwebp-dev \
41    libjpeg62-turbo-dev \
42    libpng-dev \
43    libzip-dev \
44    nano \
45    mc \
46    git-core \
47    libmagickwand-dev \
48    curl \
49    build-essential \
50    openssl \
51    libssl-dev \
52    libgmp-dev \
53    libldap2-dev \
54    netcat \
55    locate \
56    # composer \
57    && git clone https://github.com/nodejs/node.git && \
58    cd node  \
59    && git checkout v12.0.0 \
60    && ./configure \
61    && make \
62    && make install
63
64  RUN pecl install imagick \
65    && docker-php-ext-enable imagick
66
67    RUN npm install cross-env
68
69    RUN npm install -g yarn
70
71    # RUN  docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/
72    RUN docker-php-ext-configure gd --with-freetype --with-jpeg
73    # READ https://github.com/docker-library/php/issues/912#issuecomment-559918036
74
75
76    # Install Composer
77    RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
78
79    RUN  docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif  \
80    && a2enmod rewrite
81
82    RUN apt-get install -y grep mlocate
83
84    RUN docker-php-ext-install imagick
85
86    COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
87docker-compose up -d --build
88Need to get 97.7 kB of archives.
89After this operation, 504 kB of additional disk space will be used.
90Get:1 http://deb.debian.org/debian buster/main amd64 mlocate amd64 0.26-3 [97.7 kB]
91debconf: delaying package configuration, since apt-utils is not installed
92Fetched 97.7 kB in 0s (729 kB/s)
93Selecting previously unselected package mlocate.
94(Reading database ... 22379 files and directories currently installed.)
95Preparing to unpack .../mlocate_0.26-3_amd64.deb ...
96Unpacking mlocate (0.26-3) ...
97Setting up mlocate (0.26-3) ...
98update-alternatives: using /usr/bin/mlocate to provide /usr/bin/locate (locate) in auto mode
99update-alternatives: warning: skip creation of /usr/share/man/man1/locate.1.gz because associated file /usr/share/man/man1/mlocate.1.gz (of link group locate) doesn't exist
100update-alternatives: warning: skip creation of /usr/share/man/man8/updatedb.8.gz because associated file /usr/share/man/man8/updatedb.mlocate.8.gz (of link group locate) doesn't exist
101Adding group `mlocate' (GID 101) ...
102Done.
103Removing intermediate container 40f86f34f2af
104 ---> edaee648df84
105Step 10/11 : RUN docker-php-ext-install imagick
106 ---> Running in a72d0887a6b0
107error: /usr/src/php/ext/imagick does not exist
108
109usage: /usr/local/bin/docker-php-ext-install [-jN] ext-name [ext-name ...]
110   ie: /usr/local/bin/docker-php-ext-install gd mysqli
111       /usr/local/bin/docker-php-ext-install pdo pdo_mysql
112       /usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop
113
114if custom ./configure arguments are necessary, see docker-php-ext-configure
115
116Possible values for ext-name:
117bcmath bz2 calendar ctype curl dba dom enchant exif ffi fileinfo filter ftp gd gettext gmp hash iconv imap intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlrpc xmlwriter xsl zend_test zip
118
119Some of the above modules are already compiled into PHP; please check
120the output of "php -i" to see which modules are already loaded.
121ERROR: Service 'web' failed to build: The command '/bin/sh -c docker-php-ext-install imagick' returned a non-zero code: 1
122You should add "extension=imagick.so" to php.ini
123

is just a warning that is addressed later in your Dockerfile. The real error is caused by the execution of the non existing binary imagick.

You can simplify your Dockerfile as follows:

1FROM php:7.4.1-apache
2
3RUN apt-get update && \
4    apt-get install -y \
5        python \
6        libfreetype6-dev \
7        libwebp-dev \
8        libjpeg62-turbo-dev \
9        libpng-dev \
10        libzip-dev \
11        nano \
12        mc \
13        git-core \    
14        libmagickwand-dev --no-install-recommends && \
15    pecl install imagick && imagick && \
16    docker-php-ext-enable imagick && \
17    curl ...
18    
19RUN docker-php-ext-install \
20        gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif && \
21    a2enmod rewrite
22
23RUN install-php-extensions imagick
24    
25COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
26Build process completed successfully
27Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so'
28Installing '/usr/local/include/php/ext/imagick/php_imagick_shared.h'
29install ok: channel://pecl.php.net/imagick-3.5.1
30configuration option "php_ini" is not set to php.ini location
31You should add "extension=imagick.so" to php.ini
32/bin/sh: 1: imagick: not found
33ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update &&     apt-get install -y     python     libfreetype6-dev     libwebp-dev     libjpeg62-turbo-dev     libpng-dev     libzip-dev     nano     mc     git-core     libmagickwand-dev --no-install-recommends &&     pecl install imagick && imagick &&     docker-php-ext-enable imagick &&     curl     build-essential     openssl     libssl-dev     libgmp-dev     libldap2-dev     netcat     locate     && git clone https://github.com/nodejs/node.git &&     cd node      && git checkout v12.0.0     && ./configure     && make     && make install' returned a non-zero code: 127
34  FROM php:7.4.1-apache
35    RUN apt-get update && \
36#    apt-get install -y \
37    apt-get install --assume-yes --no-install-recommends --quiet \
38    python \
39    libfreetype6-dev \
40    libwebp-dev \
41    libjpeg62-turbo-dev \
42    libpng-dev \
43    libzip-dev \
44    nano \
45    mc \
46    git-core \
47    libmagickwand-dev \
48    curl \
49    build-essential \
50    openssl \
51    libssl-dev \
52    libgmp-dev \
53    libldap2-dev \
54    netcat \
55    locate \
56    # composer \
57    && git clone https://github.com/nodejs/node.git && \
58    cd node  \
59    && git checkout v12.0.0 \
60    && ./configure \
61    && make \
62    && make install
63
64  RUN pecl install imagick \
65    && docker-php-ext-enable imagick
66
67    RUN npm install cross-env
68
69    RUN npm install -g yarn
70
71    # RUN  docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/
72    RUN docker-php-ext-configure gd --with-freetype --with-jpeg
73    # READ https://github.com/docker-library/php/issues/912#issuecomment-559918036
74
75
76    # Install Composer
77    RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
78
79    RUN  docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif  \
80    && a2enmod rewrite
81
82    RUN apt-get install -y grep mlocate
83
84    RUN docker-php-ext-install imagick
85
86    COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
87docker-compose up -d --build
88Need to get 97.7 kB of archives.
89After this operation, 504 kB of additional disk space will be used.
90Get:1 http://deb.debian.org/debian buster/main amd64 mlocate amd64 0.26-3 [97.7 kB]
91debconf: delaying package configuration, since apt-utils is not installed
92Fetched 97.7 kB in 0s (729 kB/s)
93Selecting previously unselected package mlocate.
94(Reading database ... 22379 files and directories currently installed.)
95Preparing to unpack .../mlocate_0.26-3_amd64.deb ...
96Unpacking mlocate (0.26-3) ...
97Setting up mlocate (0.26-3) ...
98update-alternatives: using /usr/bin/mlocate to provide /usr/bin/locate (locate) in auto mode
99update-alternatives: warning: skip creation of /usr/share/man/man1/locate.1.gz because associated file /usr/share/man/man1/mlocate.1.gz (of link group locate) doesn't exist
100update-alternatives: warning: skip creation of /usr/share/man/man8/updatedb.8.gz because associated file /usr/share/man/man8/updatedb.mlocate.8.gz (of link group locate) doesn't exist
101Adding group `mlocate' (GID 101) ...
102Done.
103Removing intermediate container 40f86f34f2af
104 ---> edaee648df84
105Step 10/11 : RUN docker-php-ext-install imagick
106 ---> Running in a72d0887a6b0
107error: /usr/src/php/ext/imagick does not exist
108
109usage: /usr/local/bin/docker-php-ext-install [-jN] ext-name [ext-name ...]
110   ie: /usr/local/bin/docker-php-ext-install gd mysqli
111       /usr/local/bin/docker-php-ext-install pdo pdo_mysql
112       /usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop
113
114if custom ./configure arguments are necessary, see docker-php-ext-configure
115
116Possible values for ext-name:
117bcmath bz2 calendar ctype curl dba dom enchant exif ffi fileinfo filter ftp gd gettext gmp hash iconv imap intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlrpc xmlwriter xsl zend_test zip
118
119Some of the above modules are already compiled into PHP; please check
120the output of "php -i" to see which modules are already loaded.
121ERROR: Service 'web' failed to build: The command '/bin/sh -c docker-php-ext-install imagick' returned a non-zero code: 1
122You should add "extension=imagick.so" to php.ini
123FROM php:7.4.1-apache
124
125RUN apt-get update \
126 && apt-get install --assume-yes --no-install-recommends --quiet \
127    build-essential \
128    libmagickwand-dev
129    libmagickwand-dev \
130 && apt-get clean all
131
132RUN pecl install imagick \
133 && docker-php-ext-enable imagick
134

This should fix the issue.

Output:

1FROM php:7.4.1-apache
2
3RUN apt-get update && \
4    apt-get install -y \
5        python \
6        libfreetype6-dev \
7        libwebp-dev \
8        libjpeg62-turbo-dev \
9        libpng-dev \
10        libzip-dev \
11        nano \
12        mc \
13        git-core \    
14        libmagickwand-dev --no-install-recommends && \
15    pecl install imagick && imagick && \
16    docker-php-ext-enable imagick && \
17    curl ...
18    
19RUN docker-php-ext-install \
20        gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif && \
21    a2enmod rewrite
22
23RUN install-php-extensions imagick
24    
25COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
26Build process completed successfully
27Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so'
28Installing '/usr/local/include/php/ext/imagick/php_imagick_shared.h'
29install ok: channel://pecl.php.net/imagick-3.5.1
30configuration option "php_ini" is not set to php.ini location
31You should add "extension=imagick.so" to php.ini
32/bin/sh: 1: imagick: not found
33ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update &&     apt-get install -y     python     libfreetype6-dev     libwebp-dev     libjpeg62-turbo-dev     libpng-dev     libzip-dev     nano     mc     git-core     libmagickwand-dev --no-install-recommends &&     pecl install imagick && imagick &&     docker-php-ext-enable imagick &&     curl     build-essential     openssl     libssl-dev     libgmp-dev     libldap2-dev     netcat     locate     && git clone https://github.com/nodejs/node.git &&     cd node      && git checkout v12.0.0     && ./configure     && make     && make install' returned a non-zero code: 127
34  FROM php:7.4.1-apache
35    RUN apt-get update && \
36#    apt-get install -y \
37    apt-get install --assume-yes --no-install-recommends --quiet \
38    python \
39    libfreetype6-dev \
40    libwebp-dev \
41    libjpeg62-turbo-dev \
42    libpng-dev \
43    libzip-dev \
44    nano \
45    mc \
46    git-core \
47    libmagickwand-dev \
48    curl \
49    build-essential \
50    openssl \
51    libssl-dev \
52    libgmp-dev \
53    libldap2-dev \
54    netcat \
55    locate \
56    # composer \
57    && git clone https://github.com/nodejs/node.git && \
58    cd node  \
59    && git checkout v12.0.0 \
60    && ./configure \
61    && make \
62    && make install
63
64  RUN pecl install imagick \
65    && docker-php-ext-enable imagick
66
67    RUN npm install cross-env
68
69    RUN npm install -g yarn
70
71    # RUN  docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/
72    RUN docker-php-ext-configure gd --with-freetype --with-jpeg
73    # READ https://github.com/docker-library/php/issues/912#issuecomment-559918036
74
75
76    # Install Composer
77    RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
78
79    RUN  docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif  \
80    && a2enmod rewrite
81
82    RUN apt-get install -y grep mlocate
83
84    RUN docker-php-ext-install imagick
85
86    COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
87docker-compose up -d --build
88Need to get 97.7 kB of archives.
89After this operation, 504 kB of additional disk space will be used.
90Get:1 http://deb.debian.org/debian buster/main amd64 mlocate amd64 0.26-3 [97.7 kB]
91debconf: delaying package configuration, since apt-utils is not installed
92Fetched 97.7 kB in 0s (729 kB/s)
93Selecting previously unselected package mlocate.
94(Reading database ... 22379 files and directories currently installed.)
95Preparing to unpack .../mlocate_0.26-3_amd64.deb ...
96Unpacking mlocate (0.26-3) ...
97Setting up mlocate (0.26-3) ...
98update-alternatives: using /usr/bin/mlocate to provide /usr/bin/locate (locate) in auto mode
99update-alternatives: warning: skip creation of /usr/share/man/man1/locate.1.gz because associated file /usr/share/man/man1/mlocate.1.gz (of link group locate) doesn't exist
100update-alternatives: warning: skip creation of /usr/share/man/man8/updatedb.8.gz because associated file /usr/share/man/man8/updatedb.mlocate.8.gz (of link group locate) doesn't exist
101Adding group `mlocate' (GID 101) ...
102Done.
103Removing intermediate container 40f86f34f2af
104 ---> edaee648df84
105Step 10/11 : RUN docker-php-ext-install imagick
106 ---> Running in a72d0887a6b0
107error: /usr/src/php/ext/imagick does not exist
108
109usage: /usr/local/bin/docker-php-ext-install [-jN] ext-name [ext-name ...]
110   ie: /usr/local/bin/docker-php-ext-install gd mysqli
111       /usr/local/bin/docker-php-ext-install pdo pdo_mysql
112       /usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop
113
114if custom ./configure arguments are necessary, see docker-php-ext-configure
115
116Possible values for ext-name:
117bcmath bz2 calendar ctype curl dba dom enchant exif ffi fileinfo filter ftp gd gettext gmp hash iconv imap intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlrpc xmlwriter xsl zend_test zip
118
119Some of the above modules are already compiled into PHP; please check
120the output of "php -i" to see which modules are already loaded.
121ERROR: Service 'web' failed to build: The command '/bin/sh -c docker-php-ext-install imagick' returned a non-zero code: 1
122You should add "extension=imagick.so" to php.ini
123FROM php:7.4.1-apache
124
125RUN apt-get update \
126 && apt-get install --assume-yes --no-install-recommends --quiet \
127    build-essential \
128    libmagickwand-dev
129    libmagickwand-dev \
130 && apt-get clean all
131
132RUN pecl install imagick \
133 && docker-php-ext-enable imagick
134STEP 1/3: FROM php:7.4.1-apache
135STEP 2/3: RUN apt-get update &&     apt-get install --assume-yes --no-install-recommends --quiet     libmagickwand-dev  && apt-get clean all
136Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
137Get:2 http://deb.debian.org/debian buster InRelease [122 kB]
138Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
139Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [307 kB]
140Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7906 kB]
141Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [15.2 kB]
142Fetched 8467 kB in 4s (2170 kB/s)
143Reading package lists...
144Reading package lists...
145Building dependency tree...
146Reading state information...
147The following additional packages will be installed:
148  automake autotools-dev fontconfig fontconfig-config fonts-dejavu-core
149  gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-rsvg-2.0
150  icu-devtools imagemagick-6-common libblkid-dev libbz2-dev libcairo-gobject2
151  libcairo-script-interpreter2 libcairo2 libcairo2-dev libcroco3 libdatrie1
152  libde265-0 libdjvulibre-dev libdjvulibre-text libdjvulibre21 libelf1
153  libexif-dev libexif12 libexpat1-dev libffi-dev libfftw3-double3
154  libfontconfig1 libfontconfig1-dev libfreetype6 libfreetype6-dev libfribidi0
155  libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common
156  libgdk-pixbuf2.0-dev libgirepository-1.0-1 libglib2.0-0 libglib2.0-bin
157  libglib2.0-data libglib2.0-dev libglib2.0-dev-bin libgraphite2-3
158  libharfbuzz0b libheif1 libice-dev libice6 libicu-dev libicu63 libilmbase-dev
159  libilmbase23 libjbig-dev libjbig0 libjpeg-dev libjpeg62-turbo
160  libjpeg62-turbo-dev liblcms2-2 liblcms2-dev liblqr-1-0 liblqr-1-0-dev
161  libltdl-dev libltdl7 liblzma-dev liblzo2-2 libmagickcore-6-arch-config
162  libmagickcore-6-headers libmagickcore-6.q16-6 libmagickcore-6.q16-6-extra
163  libmagickcore-6.q16-dev libmagickwand-6-headers libmagickwand-6.q16-6
164  libmagickwand-6.q16-dev libmount-dev libmpdec2 libnuma1 libopenexr-dev
165  libopenexr23 libopenjp2-7 libopenjp2-7-dev libpango-1.0-0
166  libpangocairo-1.0-0 libpangoft2-1.0-0 libpcre16-3 libpcre3-dev libpcre32-3
167  libpcrecpp0v5 libpixman-1-0 libpixman-1-dev libpng-dev libpng16-16
168  libpthread-stubs0-dev libpython3-stdlib libpython3.7-minimal
169  libpython3.7-stdlib libreadline7 librsvg2-2 librsvg2-common librsvg2-dev
170  libselinux1-dev libsepol1-dev libsm-dev libsm6 libthai-data libthai0
171  libtiff-dev libtiff5 libtiffxx5 libwebp6 libwebpmux3 libwmf-dev libwmf0.2-7
172  libx11-6 libx11-data libx11-dev libx265-165 libxau-dev libxau6
173  libxcb-render0 libxcb-render0-dev libxcb-shm0 libxcb-shm0-dev libxcb1
174  libxcb1-dev libxdmcp-dev libxdmcp6 libxext-dev libxext6 libxml2 libxml2-dev
175  libxrender-dev libxrender1 libxt-dev libxt6 python3 python3-distutils
176  python3-lib2to3 python3-minimal python3.7 python3.7-minimal readline-common
177  shared-mime-info ucf uuid-dev x11-common x11proto-core-dev x11proto-dev
178  x11proto-xext-dev xorg-sgml-doctools xtrans-dev zlib1g-dev
179Suggested packages:
180  autoconf-doc gnu-standards libcairo2-doc libfftw3-bin libfftw3-dev
181  freetype2-doc libglib2.0-doc libxml2-utils libice-doc icu-doc liblcms2-utils
182  libtool-doc liblzma-doc inkscape librsvg2-bin librsvg2-doc libsm-doc
183  libwmf-doc libwmf0.2-7-gtk libx11-doc libxcb-doc libxext-doc libxt-doc
184  python3-doc python3-tk python3-venv python3.7-venv python3.7-doc
185  binfmt-support readline-doc
186Recommended packages:
187  bzip2-doc libexif-doc xdg-user-dirs libtool ghostscript gsfonts libjxr-tools
188  libpng-tools
189The following NEW packages will be installed:
190  automake autotools-dev fontconfig fontconfig-config fonts-dejavu-core
191  gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-rsvg-2.0
192  icu-devtools imagemagick-6-common libblkid-dev libbz2-dev libcairo-gobject2
193  libcairo-script-interpreter2 libcairo2 libcairo2-dev libcroco3 libdatrie1
194  libde265-0 libdjvulibre-dev libdjvulibre-text libdjvulibre21 libelf1
195  libexif-dev libexif12 libexpat1-dev libffi-dev libfftw3-double3
196  libfontconfig1 libfontconfig1-dev libfreetype6 libfreetype6-dev libfribidi0
197  libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common
198  libgdk-pixbuf2.0-dev libgirepository-1.0-1 libglib2.0-bin libglib2.0-data
199  libglib2.0-dev libglib2.0-dev-bin libgraphite2-3 libharfbuzz0b libheif1
200  libice-dev libice6 libicu-dev libilmbase-dev libilmbase23 libjbig-dev
201  libjbig0 libjpeg-dev libjpeg62-turbo libjpeg62-turbo-dev liblcms2-2
202  liblcms2-dev liblqr-1-0 liblqr-1-0-dev libltdl-dev libltdl7 liblzma-dev
203  liblzo2-2 libmagickcore-6-arch-config libmagickcore-6-headers
204  libmagickcore-6.q16-6 libmagickcore-6.q16-6-extra libmagickcore-6.q16-dev
205  libmagickwand-6-headers libmagickwand-6.q16-6 libmagickwand-6.q16-dev
206  libmagickwand-dev libmount-dev libmpdec2 libnuma1 libopenexr-dev
207  libopenexr23 libopenjp2-7 libopenjp2-7-dev libpango-1.0-0
208  libpangocairo-1.0-0 libpangoft2-1.0-0 libpcre16-3 libpcre3-dev libpcre32-3
209  libpcrecpp0v5 libpixman-1-0 libpixman-1-dev libpng-dev libpng16-16
210  libpthread-stubs0-dev libpython3-stdlib libpython3.7-minimal
211  libpython3.7-stdlib libreadline7 librsvg2-2 librsvg2-common librsvg2-dev
212  libselinux1-dev libsepol1-dev libsm-dev libsm6 libthai-data libthai0
213  libtiff-dev libtiff5 libtiffxx5 libwebp6 libwebpmux3 libwmf-dev libwmf0.2-7
214  libx11-6 libx11-data libx11-dev libx265-165 libxau-dev libxau6
215  libxcb-render0 libxcb-render0-dev libxcb-shm0 libxcb-shm0-dev libxcb1
216  libxcb1-dev libxdmcp-dev libxdmcp6 libxext-dev libxext6 libxml2-dev
217  libxrender-dev libxrender1 libxt-dev libxt6 python3 python3-distutils
218  python3-lib2to3 python3-minimal python3.7 python3.7-minimal readline-common
219  shared-mime-info ucf uuid-dev x11-common x11proto-core-dev x11proto-dev
220  x11proto-xext-dev xorg-sgml-doctools xtrans-dev zlib1g-dev
221The following packages will be upgraded:
222  libglib2.0-0 libicu63 libxml2
2233 upgraded, 150 newly installed, 0 to remove and 46 not upgraded.
224Need to get 73.0 MB of archives.
225After this operation, 234 MB of additional disk space will be used.
226[...]
227--> 69135d97974
228STEP 3/3: RUN pecl install imagick  && docker-php-ext-enable imagick
229WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
230downloading imagick-3.5.1.tgz ...
231Starting to download imagick-3.5.1.tgz (301,411 bytes)
232.............................................................done: 301,411 bytes
23333 source files, building
234running: phpize
235Configuring for:
236PHP Api Version:         20190902
237Zend Module Api No:      20190902
238Zend Extension Api No:   320190902
239Please provide the prefix of ImageMagick installation [autodetect] : 
240Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in PEAR/Builder.php on line 405
241
242Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /usr/local/lib/php/PEAR/Builder.php on line 405
243building in /tmp/pear/temp/pear-build-defaultuserIJdbl7/imagick-3.5.1
244running: /tmp/pear/temp/imagick/configure --with-php-config=/usr/local/bin/php-config --with-imagick
245[...]
246checking if ImageMagick version is at least 6.2.4... found version 6.9.10
247checking for MagickWand.h or magick-wand.h header... /usr/include/ImageMagick-6/wand/MagickWand.h
248checking PHP version is at least 5.3.2... yes. found 7.4.1
249libs
250-lMagickWand-6.Q16 -lMagickCore-6.Q16
251
252checking for MagickGetVersion... yes
253[...]
254Build complete.
255Don't forget to run 'make test'.
256
257running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1" install
258Installing shared extensions:     /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1/usr/local/lib/php/extensions/no-debug-non-zts-20190902/
259Installing header files:          /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1/usr/local/include/php/
260running: find "/tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1" | xargs ls -dils
2617097429    8 drwxr-xr-x. 3 root root    4096 Oct 11 07:24 /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1
2627097485    8 drwxr-xr-x. 3 root root    4096 Oct 11 07:24 /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1/usr
2637097487    8 drwxr-xr-x. 4 root root    4096 Oct 11 07:24 /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1/usr/local
2647097498    8 drwxr-xr-x. 3 root root    4096 Oct 11 07:24 /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1/usr/local/include
2657097501    8 drwxr-xr-x. 3 root root    4096 Oct 11 07:24 /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1/usr/local/include/php
2667097503    8 drwxr-xr-x. 3 root root    4096 Oct 11 07:24 /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1/usr/local/include/php/ext
2677097505    8 drwxr-xr-x. 2 root root    4096 Oct 11 07:24 /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1/usr/local/include/php/ext/imagick
2687097507    4 -rw-r--r--. 1 root root    1828 Oct 11 07:24 /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1/usr/local/include/php/ext/imagick/php_imagick_shared.h
2697097489    8 drwxr-xr-x. 3 root root    4096 Oct 11 07:24 /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1/usr/local/lib
2707097491    8 drwxr-xr-x. 3 root root    4096 Oct 11 07:24 /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1/usr/local/lib/php
2717097493    8 drwxr-xr-x. 3 root root    4096 Oct 11 07:24 /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1/usr/local/lib/php/extensions
2727097495    8 drwxr-xr-x. 2 root root    4096 Oct 11 07:24 /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1/usr/local/lib/php/extensions/no-debug-non-zts-20190902
2737097483 1608 -rwxr-xr-x. 1 root root 1646360 Oct 11 07:24 /tmp/pear/temp/pear-build-defaultuserIJdbl7/install-imagick-3.5.1/usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so
274
275Build process completed successfully
276Installing '/usr/local/include/php/ext/imagick/php_imagick_shared.h'
277Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so'
278install ok: channel://pecl.php.net/imagick-3.5.1
279configuration option "php_ini" is not set to php.ini location
280You should add "extension=imagick.so" to php.ini
281--> 3ee934f2bbd
2823ee934f2bbdc1639a02325939d9fc1eefeb16c5803edc33424c18ecc616f7fb1
283

Source https://stackoverflow.com/questions/69507747

QUESTION

Need understanding as to why string.StartsWith() is true when it should be false

Asked 2021-Sep-28 at 12:52

So I have this file that I download via ftp. The file is just a config file for a system at my company I work for. Once the file is downloaded I open the file and processor the file. Part of the processing of the file is to check to see if a line starts with a Unicode character \u001a.

This is where I am stumped because .StartsWith("\u001a") is always true, yet I cannot see why. If I view the file in Notepad++ or in a hex editor, I just don't see that.

So there is something I am missing here.

Here's a minimal example (fiddle):

1// prints True in .NET 5
2Console.WriteLine("Hello".StartsWith("\u001a"));
3

ANSWER

Answered 2021-Sep-28 at 12:52

It's because a breaking change in the globalizations APIs in .NET 5. You can choose one of the following approaches

  1. Use StringComparison.Ordinal or OrdinalIgnoreCase
  2. Use NLS instead of ICU, with one of the following ways:
  • In the project file:
1// prints True in .NET 5
2Console.WriteLine("Hello".StartsWith("\u001a"));
3<ItemGroup>
4  <RuntimeHostConfigurationOption Include="System.Globalization.UseNls" Value="true" />
5</ItemGroup>
6
  • In the runtimeconfig.json file:
1// prints True in .NET 5
2Console.WriteLine("Hello".StartsWith("\u001a"));
3<ItemGroup>
4  <RuntimeHostConfigurationOption Include="System.Globalization.UseNls" Value="true" />
5</ItemGroup>
6{
7  "runtimeOptions": {
8     "configProperties": {
9       "System.Globalization.UseNls": true
10      }
11  }
12}
13
  • By setting the environment variable DOTNET_SYSTEM_GLOBALIZATION_USENLS to the value true or 1.

Source https://stackoverflow.com/questions/69314093

QUESTION

How can I add values from the first column to a new array?

Asked 2021-Sep-09 at 12:23

I have this code:

1unique_values = (dataset["Label"].value_counts())
2    print(unique_values)
3

And this output:

1unique_values = (dataset["Label"].value_counts())
2    print(unique_values)
3BENIGN          1378095
4PortScan         158930
5FTP-Patator        7938
6SSH-Patator        5897
7Infiltration         36
8Name: Label, dtype: int64
9

How can I add values from the first column to a new array? The first column should be this: BENIGN, PortScan,..

ANSWER

Answered 2021-Sep-09 at 11:58

Is this giving you what you want?

1unique_values = (dataset["Label"].value_counts())
2    print(unique_values)
3BENIGN          1378095
4PortScan         158930
5FTP-Patator        7938
6SSH-Patator        5897
7Infiltration         36
8Name: Label, dtype: int64
9unique_values.index.tolist()
10

Source https://stackoverflow.com/questions/69117732

QUESTION

Debian 11 Update broke samueldebruyn/debian-git?

Asked 2021-Aug-31 at 12:09

I have a staging, and a production server setup on Bitbucket Pipelines running a yaml script with the following;

1          image: samueldebruyn/debian-git
2          name: Staging - Upload FTP
3          script:
4            - apt-get update
5            - apt-get -qq install git-ftp
6            - git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD -v ftp://$FTP_HOST/$FTP_STAGING_PATH
7            - echo "Completed upload"
8

This script has been working great, and widely used in same format online for others using pipelines.

I submitted to my staging server literally 5-10 minutes before Debian 11 was released with successful builds, then post Debian 11 Release all subsequent releases Ive pushed to staging, or production result in a failure build with the following error...

1          image: samueldebruyn/debian-git
2          name: Staging - Upload FTP
3          script:
4            - apt-get update
5            - apt-get -qq install git-ftp
6            - git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD -v ftp://$FTP_HOST/$FTP_STAGING_PATH
7            - echo "Completed upload"
8Ign:1 http://security.debian.org/debian-security stable/updates InRelease
9Get:2 http://deb.debian.org/debian stable InRelease [113 kB]
10Err:3 http://security.debian.org/debian-security stable/updates Release
11  404  Not Found [IP: 151.101.250.132 80]
12Get:4 http://deb.debian.org/debian stable-updates InRelease [40.1 kB]
13Get:5 http://deb.debian.org/debian stable/main amd64 Packages [8178 kB]
14Reading package lists...
15E: The repository 'http://security.debian.org/debian-security stable/updates Release' does not have a Release file.
16

Am I missing something, or did Debian 11 just break a lot of pipelines?!

or is samueldebruyn/debian-git out of date now?

ANSWER

Answered 2021-Aug-15 at 08:11

TL;DR; The stable images on docker hub have not yet been regenerated for Debian 11, but the security repo changed layout. The next rebuild of the stable docker image should be Debian 11 based and that should fix the problem.

--- Details ---

It seems the stable and stable-slim tags are currently a bit broken at docker hub.

For Debian 10 and older, the repo uses the subdirectory structure {RELEASE}/updates to contain the security updates;

1          image: samueldebruyn/debian-git
2          name: Staging - Upload FTP
3          script:
4            - apt-get update
5            - apt-get -qq install git-ftp
6            - git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD -v ftp://$FTP_HOST/$FTP_STAGING_PATH
7            - echo "Completed upload"
8Ign:1 http://security.debian.org/debian-security stable/updates InRelease
9Get:2 http://deb.debian.org/debian stable InRelease [113 kB]
10Err:3 http://security.debian.org/debian-security stable/updates Release
11  404  Not Found [IP: 151.101.250.132 80]
12Get:4 http://deb.debian.org/debian stable-updates InRelease [40.1 kB]
13Get:5 http://deb.debian.org/debian stable/main amd64 Packages [8178 kB]
14Reading package lists...
15E: The repository 'http://security.debian.org/debian-security stable/updates Release' does not have a Release file.
16> docker run -it --rm debian:buster-slim egrep '(/se.*security)' /etc/apt/sources.list
17deb http://security.debian.org/debian-security buster/updates main
18

For Debian 11, it instead uses a directory called {RELEASE}-security

1          image: samueldebruyn/debian-git
2          name: Staging - Upload FTP
3          script:
4            - apt-get update
5            - apt-get -qq install git-ftp
6            - git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD -v ftp://$FTP_HOST/$FTP_STAGING_PATH
7            - echo "Completed upload"
8Ign:1 http://security.debian.org/debian-security stable/updates InRelease
9Get:2 http://deb.debian.org/debian stable InRelease [113 kB]
10Err:3 http://security.debian.org/debian-security stable/updates Release
11  404  Not Found [IP: 151.101.250.132 80]
12Get:4 http://deb.debian.org/debian stable-updates InRelease [40.1 kB]
13Get:5 http://deb.debian.org/debian stable/main amd64 Packages [8178 kB]
14Reading package lists...
15E: The repository 'http://security.debian.org/debian-security stable/updates Release' does not have a Release file.
16> docker run -it --rm debian:buster-slim egrep '(/se.*security)' /etc/apt/sources.list
17deb http://security.debian.org/debian-security buster/updates main
18> docker run -it --rm debian:bullseye-slim egrep '(/se.*security)' /etc/apt/sources.list
19deb http://security.debian.org/debian-security bullseye-security main
20

The problem with stable is that the image is still Debian 10 and expects stable/updates while the repo now uses the Debian 11 style stable-security. When the image pulls the security updates, it fails since the directory no longer exists with the new structure.

1          image: samueldebruyn/debian-git
2          name: Staging - Upload FTP
3          script:
4            - apt-get update
5            - apt-get -qq install git-ftp
6            - git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD -v ftp://$FTP_HOST/$FTP_STAGING_PATH
7            - echo "Completed upload"
8Ign:1 http://security.debian.org/debian-security stable/updates InRelease
9Get:2 http://deb.debian.org/debian stable InRelease [113 kB]
10Err:3 http://security.debian.org/debian-security stable/updates Release
11  404  Not Found [IP: 151.101.250.132 80]
12Get:4 http://deb.debian.org/debian stable-updates InRelease [40.1 kB]
13Get:5 http://deb.debian.org/debian stable/main amd64 Packages [8178 kB]
14Reading package lists...
15E: The repository 'http://security.debian.org/debian-security stable/updates Release' does not have a Release file.
16> docker run -it --rm debian:buster-slim egrep '(/se.*security)' /etc/apt/sources.list
17deb http://security.debian.org/debian-security buster/updates main
18> docker run -it --rm debian:bullseye-slim egrep '(/se.*security)' /etc/apt/sources.list
19deb http://security.debian.org/debian-security bullseye-security main
20> docker run -it --rm debian:stable-slim egrep '(/se.*security)' /etc/apt/sources.list
21deb http://security.debian.org/debian-security stable/updates main
22

Since the next build of the stable image should be Debian 11 based, the problem should sort itself out soon enough, but if you want to use the failing docker file until a new build is available, use buster-slim or bullseye-slim (both of which work well) instead of stable-slim.

Source https://stackoverflow.com/questions/68787732

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in FTP

Tutorials and Learning Resources are not available at this moment for FTP

Share this Page

share link

Get latest updates on FTP