'uvloop' has no attribute 'EventLoopPolicy' - python-3.x

I am testing python code performance with uvloop. I am getting 'uvloop' has no attribute 'EventLoopPolicy' error.
I am using python 3.7 and
uvloop 0.13.0
pycharm
I tried changing interpreter reinstalling uvloop but none of them did not work.
Can anyone suggest what is the problem?

Rename your own file to something else than uvloop.py, such as test_uvloop.py.
You're confusing Python's import machinery by having your own file the same name as the library you're trying to use.

I see that you're on a Mac, but I just fixed this problem on my CentOS7.x server by properly setting permissions to the uvloop Python package. It's pesky because (at least on CentOS) some pip-installed Python packages go in /usr/local/lib/python3.7/site-packages and some go in /usr/local/lib64/python3.7/site-packages.
Check out what the files in my lib64 directory looked like before I fixed it:
me#myserver /usr/local/lib64/python3.7/site-packages
$ ll
total 16
drwxr-xr-x. 3 root root 4096 Jan 17 15:38 click
drwxr-xr-x. 2 root root 134 Jan 17 15:38 Click-7.0.dist-info
drwxr-x---. 4 root root 74 Jan 17 15:42 httptools
drwxr-x---. 2 root root 141 Jan 17 15:42 httptools-0.0.13-py3.6.egg-info
drwxr-x---. 3 root root 4096 Jan 17 15:43 pydantic
drwxr-x---. 2 root root 111 Jan 17 15:43 pydantic-1.3.dist-info
drwxr-x---. 5 root root 4096 Jan 17 15:43 uvloop
drwxr-x---. 2 root root 141 Jan 17 15:43 uvloop-0.14.0-py3.6.egg-info
drwxr-xr-x. 4 root root 4096 Jan 17 15:38 websockets
drwxr-xr-x. 2 root root 134 Jan 17 15:38 websockets-8.1.dist-info
Unless I was running as a root user the uvloop files are untouchable and that's what caused the error. On your Mac, try to find where your uvloop package is installed and make sure your script can access it.

Related

PostgreSQL create extension mongo_fdw

I want to connect a PostgreSQL database with a MongoDB by using Mongo_fdw. After following this instruction to install mongo_fdw with the autogen.sh script on Ubuntu 22.04 LTS, I wanted to check the connection and ran CREATE EXTENSION mongo_fdw; in my database, but the following error occured:
ERROR: could not access file "$libdir/mongo_fdw": No such file or directory
Searchig for a solution I found this page on GitHub, where the same error is discussed. Following the recommendations there, I checked pg_config --version, pg_config --libdir and pg_config --sharedir with the following results:
$ pg_config --version
PostgreSQL 12.9
$ pg_config --libdir
/home/qgis/anaconda3/lib
$ pg_config --sharedir
/home/qgis/anaconda3/share
When I check /home/qgis/anaconda3/share/extension I get the following files:
drwxrwxr-x 2 qgis qgis 4096 Feb 1 10:58 ./
drwxrwxr-x 32 qgis qgis 4096 Jan 18 10:28 ../
-rw-r--r-- 1 root root 157 Feb 1 10:58 mongo_fdw--1.0--1.1.sql
-rw-r--r-- 1 root root 593 Feb 1 10:58 mongo_fdw--1.0.sql
-rw-r--r-- 1 root root 709 Feb 1 10:58 mongo_fdw--1.1.sql
-rw-r--r-- 1 root root 274 Feb 1 10:58 mongo_fdw.control
-rw-rw-r-- 2 qgis qgis 310 Jun 24 2022 plpgsql--1.0.sql
-rw-rw-r-- 2 qgis qgis 179 Jun 24 2022 plpgsql.control
-rw-rw-r-- 2 qgis qgis 370 Jun 24 2022 plpgsql--unpackaged--1.0.sql
I also ran ldconfig as it is recommended on the GitHub page but with no results.
Does someone has an idea how to solve this error?
Thanks in advance!
You have to specify the correct pg_config when building the software, probably
make PG_CONFIG=/usr/lib/postgresql/14/bin/pg_config
That file should exist if you installed the package with the C headers, which is typically called "devel" or "dev" or similar.

How to update homebrew in preparation for installing node/npm on macOS Mojave

I attempted to install node.js/npm onto a macbook running Mojave 10.14.5 so that I can do local development of a web app. From internet research my understanding is the first step is updating homebrew in preparation for installation but I got the error "Error: /usr/local must be writable!" when I ran:
brew update
I searched the internet and other people appeared to have the command below fix the problem, but for me that didn't work and I still got the error.
sudo chown -R $(whoami) $(brew --prefix)/*
Can anyone offer any advice as to what I can do so that I can update brew and install node.js/npm? Is the brew update required or should I just skip that step?
Below is the output from brew --prefix that may help...
MacBook-Pro:usr dannyboy$ ls -l $(brew --prefix)
total 215896
-rw-r--r-- 1 dannyboy admin 3161 May 23 2016 CODEOFCONDUCT.md
drwxr-xr-x 5 dannyboy admin 160 Nov 4 2018 Cellar
-rw-r--r-- 1 dannyboy admin 1241 Jan 13 2016 LICENSE.txt
drwxr-xr-x 11 dannyboy admin 352 Nov 4 2018 Library
-rw-r--r-- 1 dannyboy admin 3918 May 23 2016 README.md
drwxrwxr-x 33 dannyboy admin 1056 Nov 4 2018 bin
drwxr-xr-x 3 dannyboy admin 96 Nov 4 2018 etc
lrwxr-xr-x 1 dannyboy admin 27 May 22 2016 hadoop -> /usr/local/hadoop-2.7.2-src
drwxr-xr-x# 22 dannyboy staff 704 Nov 4 2018 hadoop-2.7.2-src
-rw-r--r--# 1 dannyboy staff 110520320 May 22 2016 hadoop-2.7.2-src.tar
drwxrwxr-x 30 dannyboy admin 960 Nov 4 2018 include
drwxrwxr-x 23 dannyboy admin 736 Nov 4 2018 lib
drwxr-xr-x 5 dannyboy wheel 160 Nov 4 2018 man
lrwxr-xr-x 1 dannyboy wheel 27 Jan 18 2014 mysql -> mysql-5.6.15-osx10.7-x86_64
drwxr-xr-x 18 dannyboy wheel 576 Nov 4 2018 mysql-5.6.15-osx10.7-x86_64
-rw-r--r-- 1 dannyboy owner 1536 Jan 18 2014 mysql_db_backup_20140118.libertyrocks.tar
drwxr-xr-x 5 dannyboy admin 160 Nov 4 2018 opt
drwxr-xr-x 3 dannyboy wheel 96 Nov 4 2018 remotedesktop
drwxrwxr-x 9 dannyboy admin 288 Nov 4 2018 share
Also requested...
MacBook-Pro:usr dannyboy$ ls -l /usr
total 0
drwxr-xr-x 971 root wheel 31072 May 15 01:37 bin
drwxr-xr-x 307 root wheel 9824 May 15 01:37 lib
drwxr-xr-x 250 root wheel 8000 May 15 01:37 libexec
drwxr-xr-x 27 root wheel 864 Nov 4 2018 local
drwxr-xr-x 239 root wheel 7648 May 15 01:37 sbin
drwxr-xr-x 46 root wheel 1472 Nov 4 2018 share
drwxr-xr-x 5 root wheel 160 Sep 21 2018 standalone

Which certificate from Let's Encrypt does a website use for HTTPS?

I have a website that was set up to use https using a certificate from Let's Encrypt. I am trying to add that certificate to a keystore to use https with a dropwizzard API. The problem I am having is that there are multiple certificates.
My question is how can I figure out which of the certificates my website uses so that I could use that for the API as well?
In /etc/ssl/certs this is what shows up:
lrwxrwxrwx 1 root root 49 Nov 20 2017 ca-bundle.crt -> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
-rw-r--r-- 1 root root 885625 Apr 12 00:27 ca-bundle.crt.rpmnew
lrwxrwxrwx 1 root root 55 Nov 20 2017 ca-bundle.trust.crt -> /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
-rw-r--r-- 1 root root 1059673 Apr 12 00:27 ca-bundle.trust.crt.rpmnew
-rw------- 1 root root 1586 Dec 15 2017 localhost.crt
-rwxr-xr-x 1 root root 610 Aug 17 17:16 make-dummy-cert
-rw-r--r-- 1 root root 2516 Aug 17 17:16 Makefile
-rwxr-xr-x 1 root root 829 Aug 17 17:16 renew-dummy-cert
After looking more closely at the config files like Patrick had suggested I found the config file in /etc/httpd/conf.d/ssl.conf that had the path to where the certificate and private key were.
You can have a look at your vhost file to see the path to the physical ssl cert files being used by the website. The vhost is likely going to be at /etc/apache2/sites-available/ .

OpenJDK-9 JDK not present on Ubuntu 17.10

I'm trying to install java 9 jre and jdk on ubuntu. But i cannot find it. I installed all the packages:
ii openjdk-9-jdk:amd64 9~b181-4 amd64 OpenJDK Development Kit (JDK)
ii openjdk-9-jdk-headless:amd64 9~b181-4 amd64 OpenJDK Development Kit (JDK) (headless)
ii openjdk-9-jre:amd64 9~b181-4 amd64 OpenJDK Java runtime, using Hotspot JIT
ii openjdk-9-jre-headless:amd64 9~b181-4 amd64 OpenJDK Java runtime, using Hotspot JIT (headless)
Java -version returns:
openjdk version "9-Ubuntu"
OpenJDK Runtime Environment (build 9-Ubuntu+0-9b181-4)
OpenJDK 64-Bit Server VM (build 9-Ubuntu+0-9b181-4, mixed mode)
javac -version:
javac 9-Ubuntu
But when I try to create JDK in new Intellij:
Then i get error:
I checked the content of /usr/lib/jvm/ and:
For java-8-openjdk-amd64:
drwxr-xr-x 7 root root 4096 gru 17 16:16 ./
drwxr-xr-x 4 root root 4096 gru 18 18:11 ../
lrwxrwxrwx 1 root root 22 paź 24 00:43 ASSEMBLY_EXCEPTION -> jre/ASSEMBLY_EXCEPTION
drwxr-xr-x 2 root root 4096 gru 17 16:16 bin/
lrwxrwxrwx 1 root root 41 paź 24 00:43 docs -> ../../../share/doc/openjdk-8-jre-headless/
drwxr-xr-x 3 root root 4096 gru 17 16:16 include/
drwxr-xr-x 5 root root 4096 gru 17 16:16 jre/
drwxr-xr-x 3 root root 4096 gru 17 16:16 lib/
drwxr-xr-x 4 root root 4096 gru 17 16:16 man/
lrwxrwxrwx 1 root root 20 paź 24 00:43 src.zip -> ../openjdk-8/src.zip
lrwxrwxrwx 1 root root 22 paź 24 00:43 THIRD_PARTY_README -> jre/THIRD_PARTY_README
For java-9-openjdk-amd64:
drwxr-xr-x 9 root root 4096 gru 18 18:11 ./
drwxr-xr-x 4 root root 4096 gru 18 18:11 ../
drwxr-xr-x 2 root root 4096 gru 18 18:11 bin/
drwxr-xr-x 4 root root 4096 gru 18 18:11 conf/
lrwxrwxrwx 1 root root 41 sie 24 19:15 docs -> ../../../share/doc/openjdk-9-jre-headless/
drwxr-xr-x 3 root root 4096 gru 18 18:11 include/
drwxr-xr-x 2 root root 4096 gru 18 18:11 jmods/
drwxr-xr-x 77 root root 4096 gru 18 18:11 legal/
drwxr-xr-x 5 root root 4096 gru 18 18:11 lib/
drwxr-xr-x 4 root root 4096 gru 18 18:11 man/
lrwxrwxrwx 1 root root 20 sie 24 19:15 src.zip -> ../openjdk-9/src.zip
My question is what went wrong? To install java-9 i used:
sudo apt install openjdk-9-jre openjdk-9-jdk
I found an issue on idea tracker
https://youtrack.jetbrains.com/issue/IDEA-178743
It's fixed. Also users suggested x86_64- version. Try with it.(source)

Linux Build Package - Configure Script Throws Error, But it's Wrong

Server: SLES v11 sp3
Kernel: 3.0.101-0.47.71-default
Arch: x86_64
So I am trying to build a src package and when I run the "./configure" script it's throwing some errors that required packages are missing. Since it's x86_64 I thought adding "--libdir=/usr/lib64" or "--libdir=/lib64" would help it find the packages it's looking for but I get the same error either way.
The configure Script is failing with this error:
..........
...SNIP...
..........
checking for xgettext... (cached) /usr/bin/xgettext
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GEDIT... configure: error: Package requirements (
glib-2.0 >= 2.13.0
gio-2.0 >= 2.16.0
gtk+-2.0 >= 2.13.0
gconf-2.0 >= 1.1.11
gtksourceview-2.0 >= 2.5.1
gedit-2.20 >= 2.25.4
) were not met:
No package 'glib-2.0' found
No package 'gio-2.0' found
No package 'gtk+-2.0' found
No package 'gconf-2.0' found
No package 'gtksourceview-2.0' found
No package 'gedit-2.20' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables GEDIT_CFLAGS
and GEDIT_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
I checked to make sure I actually have these packages and it seems as though I do. So I'm not sure if it's just not finding them or what... And it also seems as though I have versions of those packages >= what they are asking for, so I'm kinda stumped...
My Installed packages are:
# rpm -qa | grep -i glib-2
libglib-2_0-0-2.22.5-0.8.14.1
# rpm -qa | grep -i 'gtk2'
gtk2-32bit-2.18.9-0.35.1
gtk2-2.18.9-0.35.1
gtk2-engines-2.16.1-4.26
gtk2-branding-SLES-for-VMware-11.1-0.5.99
gtk2-engines-32bit-2.16.1-4.26
gtk2-themes-0.1-737.22
gtk2-lang-2.18.9-0.35.1
gtk2-theme-SLES-for-VMware-11.1-0.7.95
# rpm -qa | grep -i 'gio'
libgio-2_0-0-32bit-2.22.5-0.8.14.1
libgio-2_0-0-2.22.5-0.8.14.1
# rpm -qa | grep -i 'gconf2'
gconf2-2.28.0-1.8.1
gconf2-lang-2.28.0-1.8.1
# rpm -qa | grep -i 'gtksource'
gtksourceview-lang-2.8.2-0.1.195
libgtksourceview-2_0-0-2.8.2-0.1.195
python-gtksourceview-2.4.0-1.32
# rpm -qa | grep -i 'gedit'
gedit-2.28.3-0.8.1
gedit-lang-2.28.3-0.8.1
Anyone have any ideas what the issue could be here? I'm not sure what else to try..?
I had also tried installing the RPM based package but get similar errors for missing packages. See RPM Installation error below...
warning: gedit-plugins-2.28.0-2.el6.x86_64.rpm: Header V3 RSA/SHA256 signature: NOKEY, key ID c105b9de
error: Failed dependencies:
GConf2 is needed by gedit-plugins-2.28.0-2.el6.x86_64
pygobject2 is needed by gedit-plugins-2.28.0-2.el6.x86_64
pygtk2 is needed by gedit-plugins-2.28.0-2.el6.x86_64
pygtksourceview is needed by gedit-plugins-2.28.0-2.el6.x86_64
rpmlib(FileDigests) <= 4.6.0-1 is needed by gedit-plugins-2.28.0-2.el6.x86_64
If anyone has ANY thoughts or suggestions please feel free to reply, it would be much very appreciated!
Thanks in Advance,
Matt
Well I was unable to resolve those errors directly with compiling... However, we have another server with the same OS and everything that already had that package installed (which added more to my confusion why it wasn't working) so to just give it a try I copied that server's directory "/usr/lib64/gedit-2/plugins" to the one I was working on and now everything seems to be working just fine. All the plugins were able to be activated and they seem to work.!
The contents of the directory that I copied over were:
/usr/lib64/gedit-2/plugins # ll
total 700
drwxr-xr-x 4 root root 4096 Apr 28 2015 advancedfind
-rwxr-xr-x 1 root root 216 Apr 28 2015 advancedfind.gedit-plugin
-rw-r--r-- 1 root root 9856 Nov 13 2012 changecase.gedit-plugin
-rw-r--r-- 1 root root 6970 Apr 17 2014 codecomment.gedit-plugin
-rw-r--r-- 1 root root 9563 Mar 18 2014 codecomment.py
-rw-r--r-- 1 root root 8850 Apr 16 2014 codecomment.pyc
-rw-r--r-- 1 root root 8745 Mar 18 2014 codecomment.pyo
-rw-r--r-- 1 root root 18084 Nov 13 2012 docinfo.gedit-plugin
drwxr-xr-x 2 root root 4096 Jul 2 2013 externaltools
-rw-r--r-- 1 root root 9243 Nov 13 2012 externaltools.gedit-plugin
-rw-r--r-- 1 root root 8579 Nov 13 2012 filebrowser.gedit-plugin
-rw-r--r-- 1 root root 179 Apr 17 2014 gpdefs.py
-rw-r--r-- 1 root root 317 Apr 17 2014 gpdefs.pyc
-rw-r--r-- 1 root root 315 Apr 17 2014 gpdefs.pyo
-rw-r--r-- 1 root root 9654 Nov 13 2012 indent.gedit-plugin
-rwxr-xr-x 1 root root 18936 Nov 13 2012 libchangecase.so
-rwxr-xr-x 1 root root 19032 Nov 13 2012 libdocinfo.so
-rwxr-xr-x 1 root root 170256 Nov 13 2012 libfilebrowser.so
-rwxr-xr-x 1 root root 14816 Nov 13 2012 libindent.so
-rwxr-xr-x 1 root root 27320 Nov 13 2012 libmodelines.so
-rwxr-xr-x 1 root root 23248 Nov 13 2012 libsort.so
-rwxr-xr-x 1 root root 82168 Nov 13 2012 libspell.so
-rwxr-xr-x 1 root root 36104 Nov 13 2012 libtaglist.so
-rwxr-xr-x 1 root root 35840 Nov 13 2012 libtime.so
-rw-r--r-- 1 root root 9177 Nov 13 2012 modelines.gedit-plugin
drwxr-xr-x 2 root root 4096 Jul 2 2013 pythonconsole
-rw-r--r-- 1 root root 8602 Nov 13 2012 pythonconsole.gedit-plugin
drwxr-xr-x 2 root root 4096 Jul 2 2013 quickopen
-rw-r--r-- 1 root root 5719 Nov 13 2012 quickopen.gedit-plugin
drwxr-xr-x 2 root root 4096 Mar 20 2015 sessionsaver
-rw-r--r-- 1 root root 6035 Mar 20 2015 sessionsaver.gedit-plugin
drwxr-xr-x 2 root root 4096 Jul 2 2013 snippets
-rw-r--r-- 1 root root 8805 Nov 13 2012 snippets.gedit-plugin
-rw-r--r-- 1 root root 9235 Nov 13 2012 sort.gedit-plugin
-rw-r--r-- 1 root root 9416 Nov 13 2012 spell.gedit-plugin
-rw-r--r-- 1 root root 16794 Nov 13 2012 taglist.gedit-plugin
-rw-r--r-- 1 root root 11861 Nov 13 2012 time.gedit-plugin
And since all these plugins seem to be working without any issuse I guess the configure script was wrong about the missing requirements as I had thought...
Thanks anyways....!

Resources