InfluxDB not connecting to new VM

I am trying to run Influx-Python client in a new VM, I changed the host name and installed the requirements on new VM. Influx works on CLI. But when I run the code to create database through python it keeps giving me this error.
Does anyone know how I Can fix it? It still works fine with old VM (old host name and code).
Caused by NewConnectionError(’<urllib3.connection.HTTPConnection object at 0x7f80e5e09a90>: Failed to establish a new connection: [Errno 110] Connection timed out’,))

Hello! What version of influx and client are you using?

I am using Influx version - 1.7.7
Client version - 4.1.1-2

I know that this may sound silly, but check the network? Verify that you can hit Influx at the address you expect; the CLI uses localhost by default, so Influx is running and accessible there. This probably has nothing to do with Influx because this error means the client can’t reach the database.

Maybe try updating the client too? the latest release is 5.2.3