We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
PyCBC can't import its own version
It seems that a broken relative import means pycbc can't actually import its own version, from `ldas-pcdev1.ligo.caltech.edu`:

```bash
$ . /cvmfs/oasis.opensciencegrid.org/ligo/sw/pycbc/x86_64_rhel_7/virtualenv/pycbc-v1.9.2/bin/activate
(pycbc-v1.9.2) $ python -c "import pycbc; print(pycbc.pycbc_version)"
none
```

The fix is pretty trivial, I will post a PR shortly.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pycbc/__init__.py`
Content:
```
1 # Copyright (C) 2012  Alex Nitz, Josh Willis
2 #
3 # This program is free software; you can redistribute it and/or modify it
4 # under the terms of the GNU General Public License as published by the
5 # Free Software Foundation; either version 3 of the License, or (at your
6 # option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
11 # Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License along
14 # with this program; if not, write to the Free Software Foundation, Inc.,
15 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
16 
17 
18 #
19 # =============================================================================
20 #
21 #                                   Preamble
22 #
23 # =============================================================================
24 #
25 """PyCBC contains a toolkit for CBC gravitational wave analysis
26 """
27 from __future__ import (absolute_import, print_function)
28 import subprocess, os, sys, tempfile
29 import logging
30 import signal
31 
32 try:
33     # This will fail when pycbc is imported during the build process,
34     # before version.py has been generated.
35     from version import git_hash
36     from version import version as pycbc_version
37 except:
38     git_hash = 'none'
39     pycbc_version = 'none'
40 
41 def init_logging(verbose=False, format='%(asctime)s %(message)s'):
42     """ Common utility for setting up logging in PyCBC.
43 
44     Installs a signal handler such that verbosity can be activated at
45     run-time by sending a SIGUSR1 to the process.
46     """
47     def sig_handler(signum, frame):
48         logger = logging.getLogger()
49         log_level = logger.level
50         if log_level == logging.DEBUG:
51             log_level = logging.WARN
52         else:
53             log_level = logging.DEBUG
54         logging.warn('Got signal %d, setting log level to %d',
55                      signum, log_level)
56         logger.setLevel(log_level)
57 
58     signal.signal(signal.SIGUSR1, sig_handler)
59 
60     if verbose:
61         initial_level = logging.DEBUG
62     else:
63         initial_level = logging.WARN
64     logging.getLogger().setLevel(initial_level)
65     logging.basicConfig(format=format, level=initial_level)
66 
67 
68 # Check for optional components of the PyCBC Package
69 try:
70     # This is a crude check to make sure that the driver is installed
71     try:
72         loaded_modules = subprocess.Popen(['lsmod'], stdout=subprocess.PIPE).communicate()[0]
73         loaded_modules = loaded_modules.decode()
74         if 'nvidia' not in loaded_modules:
75             raise ImportError("nvidia driver may not be installed correctly")
76     except OSError:
77         pass
78 
79     # Check that pycuda is installed and can talk to the driver
80     import pycuda.driver as _pycudadrv
81 
82     HAVE_CUDA=True 
83 except ImportError:
84     HAVE_CUDA=False
85     
86 # Check for openmp suppport, currently we pressume it exists, unless on 
87 # platforms (mac) that are silly and don't use the standard gcc. 
88 if sys.platform == 'darwin':
89     HAVE_OMP = False
90 else:
91     HAVE_OMP = True
92 
93 # PyCBC-Specific Constants
94 
95 # Set the value we want any aligned memory calls to use
96 # N.B.: *Not* all pycbc memory will be aligned to multiples
97 # of this value
98 
99 PYCBC_ALIGNMENT = 32
100 
101 # Dynamic range factor: a large constant for rescaling
102 # GW strains.  This is 2**69 rounded to 17 sig.fig.
103 
104 DYN_RANGE_FAC =  5.9029581035870565e+20
105 
106 if os.environ.get("INITIAL_LOG_LEVEL", None):
107     logging.basicConfig(format='%(asctime)s %(message)s',
108                         level=int(os.environ["INITIAL_LOG_LEVEL"]))
109 
110 # Make sure we use a user specific, machine specific compiled cache location
111 _python_name =  "python%d%d_compiled" % tuple(sys.version_info[:2])
112 _tmp_dir = tempfile.gettempdir()
113 _cache_dir_name = repr(os.getuid()) + '_' + _python_name
114 _cache_dir_path = os.path.join(_tmp_dir, _cache_dir_name)
115 # Append the git hash to the cache path.  This will ensure that cached 
116 # files are correct even in cases where weave currently doesn't realize
117 # that a recompile is needed.
118 # FIXME: It would be better to find a way to trigger a recompile off
119 # of all the arguments to weave.
120 _cache_dir_path = os.path.join(_cache_dir_path, pycbc_version)
121 _cache_dir_path = os.path.join(_cache_dir_path, git_hash)
122 if os.environ.get("NO_TMPDIR", None):
123     if os.environ.get("INITIAL_LOG_LEVEL", 0) >= 10:
124         print("__init__: Skipped creating %s as NO_TEMPDIR is set"
125               % _cache_dir_path, file=sys.stderr)
126 else:
127     try: os.makedirs(_cache_dir_path)
128     except OSError: pass
129     if os.environ.get("INITIAL_LOG_LEVEL", 0) >= 10:
130         print("__init__: Setting weave cache to %s" % _cache_dir_path,
131               file=sys.stderr)
132 os.environ['PYTHONCOMPILED'] = _cache_dir_path
133 
134 # Check for MKL capability
135 try:
136     import pycbc.fft.mkl
137     HAVE_MKL=True
138 except ImportError as e:
139     print(e)
140     HAVE_MKL=False
141     
142 
143 # Check for site-local flags to pass to gcc
144 WEAVE_FLAGS = '-march=native -O3 -w '
145 if 'WEAVE_FLAGS' in os.environ:
146     if '-march=' in os.environ['WEAVE_FLAGS']:
147         WEAVE_FLAGS = os.environ['WEAVE_FLAGS']
148     else:
149         WEAVE_FLAGS += os.environ['WEAVE_FLAGS']
150 
151 def multiprocess_cache_dir():
152     import multiprocessing
153     cache_dir =  os.path.join(_cache_dir_path,  str(id(multiprocessing.current_process())))
154     os.environ['PYTHONCOMPILED'] = cache_dir
155     try: os.makedirs(cache_dir)
156     except OSError: pass
157
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pycbc/__init__.py b/pycbc/__init__.py
--- a/pycbc/__init__.py
+++ b/pycbc/__init__.py
@@ -32,12 +32,15 @@
 try:
     # This will fail when pycbc is imported during the build process,
     # before version.py has been generated.
-    from version import git_hash
-    from version import version as pycbc_version
+    from .version import git_hash
+    from .version import version as pycbc_version
 except:
     git_hash = 'none'
     pycbc_version = 'none'
 
+__version__ = pycbc_version
+
+
 def init_logging(verbose=False, format='%(asctime)s %(message)s'):
     """ Common utility for setting up logging in PyCBC.

{"golden_diff": "diff --git a/pycbc/__init__.py b/pycbc/__init__.py\n--- a/pycbc/__init__.py\n+++ b/pycbc/__init__.py\n@@ -32,12 +32,15 @@\n try:\n     # This will fail when pycbc is imported during the build process,\n     # before version.py has been generated.\n-    from version import git_hash\n-    from version import version as pycbc_version\n+    from .version import git_hash\n+    from .version import version as pycbc_version\n except:\n     git_hash = 'none'\n     pycbc_version = 'none'\n \n+__version__ = pycbc_version\n+\n+\n def init_logging(verbose=False, format='%(asctime)s %(message)s'):\n     \"\"\" Common utility for setting up logging in PyCBC.\n", "issue": "PyCBC can't import its own version\nIt seems that a broken relative import means pycbc can't actually import its own version, from `ldas-pcdev1.ligo.caltech.edu`:\r\n\r\n```bash\r\n$ . /cvmfs/oasis.opensciencegrid.org/ligo/sw/pycbc/x86_64_rhel_7/virtualenv/pycbc-v1.9.2/bin/activate\r\n(pycbc-v1.9.2) $ python -c \"import pycbc; print(pycbc.pycbc_version)\"\r\nnone\r\n```\r\n\r\nThe fix is pretty trivial, I will post a PR shortly.\n", "before_files": [{"content": "# Copyright (C) 2012  Alex Nitz, Josh Willis\n#\n# This program is free software; you can redistribute it and/or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation; either version 3 of the License, or (at your\n# option) any later version.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General\n# Public License for more details.\n#\n# You should have received a copy of the GNU General Public License along\n# with this program; if not, write to the Free Software Foundation, Inc.,\n# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n\n\n#\n# =============================================================================\n#\n#                                   Preamble\n#\n# =============================================================================\n#\n\"\"\"PyCBC contains a toolkit for CBC gravitational wave analysis\n\"\"\"\nfrom __future__ import (absolute_import, print_function)\nimport subprocess, os, sys, tempfile\nimport logging\nimport signal\n\ntry:\n    # This will fail when pycbc is imported during the build process,\n    # before version.py has been generated.\n    from version import git_hash\n    from version import version as pycbc_version\nexcept:\n    git_hash = 'none'\n    pycbc_version = 'none'\n\ndef init_logging(verbose=False, format='%(asctime)s %(message)s'):\n    \"\"\" Common utility for setting up logging in PyCBC.\n\n    Installs a signal handler such that verbosity can be activated at\n    run-time by sending a SIGUSR1 to the process.\n    \"\"\"\n    def sig_handler(signum, frame):\n        logger = logging.getLogger()\n        log_level = logger.level\n        if log_level == logging.DEBUG:\n            log_level = logging.WARN\n        else:\n            log_level = logging.DEBUG\n        logging.warn('Got signal %d, setting log level to %d',\n                     signum, log_level)\n        logger.setLevel(log_level)\n\n    signal.signal(signal.SIGUSR1, sig_handler)\n\n    if verbose:\n        initial_level = logging.DEBUG\n    else:\n        initial_level = logging.WARN\n    logging.getLogger().setLevel(initial_level)\n    logging.basicConfig(format=format, level=initial_level)\n\n\n# Check for optional components of the PyCBC Package\ntry:\n    # This is a crude check to make sure that the driver is installed\n    try:\n        loaded_modules = subprocess.Popen(['lsmod'], stdout=subprocess.PIPE).communicate()[0]\n        loaded_modules = loaded_modules.decode()\n        if 'nvidia' not in loaded_modules:\n            raise ImportError(\"nvidia driver may not be installed correctly\")\n    except OSError:\n        pass\n\n    # Check that pycuda is installed and can talk to the driver\n    import pycuda.driver as _pycudadrv\n\n    HAVE_CUDA=True \nexcept ImportError:\n    HAVE_CUDA=False\n    \n# Check for openmp suppport, currently we pressume it exists, unless on \n# platforms (mac) that are silly and don't use the standard gcc. \nif sys.platform == 'darwin':\n    HAVE_OMP = False\nelse:\n    HAVE_OMP = True\n\n# PyCBC-Specific Constants\n\n# Set the value we want any aligned memory calls to use\n# N.B.: *Not* all pycbc memory will be aligned to multiples\n# of this value\n\nPYCBC_ALIGNMENT = 32\n\n# Dynamic range factor: a large constant for rescaling\n# GW strains.  This is 2**69 rounded to 17 sig.fig.\n\nDYN_RANGE_FAC =  5.9029581035870565e+20\n\nif os.environ.get(\"INITIAL_LOG_LEVEL\", None):\n    logging.basicConfig(format='%(asctime)s %(message)s',\n                        level=int(os.environ[\"INITIAL_LOG_LEVEL\"]))\n\n# Make sure we use a user specific, machine specific compiled cache location\n_python_name =  \"python%d%d_compiled\" % tuple(sys.version_info[:2])\n_tmp_dir = tempfile.gettempdir()\n_cache_dir_name = repr(os.getuid()) + '_' + _python_name\n_cache_dir_path = os.path.join(_tmp_dir, _cache_dir_name)\n# Append the git hash to the cache path.  This will ensure that cached \n# files are correct even in cases where weave currently doesn't realize\n# that a recompile is needed.\n# FIXME: It would be better to find a way to trigger a recompile off\n# of all the arguments to weave.\n_cache_dir_path = os.path.join(_cache_dir_path, pycbc_version)\n_cache_dir_path = os.path.join(_cache_dir_path, git_hash)\nif os.environ.get(\"NO_TMPDIR\", None):\n    if os.environ.get(\"INITIAL_LOG_LEVEL\", 0) >= 10:\n        print(\"__init__: Skipped creating %s as NO_TEMPDIR is set\"\n              % _cache_dir_path, file=sys.stderr)\nelse:\n    try: os.makedirs(_cache_dir_path)\n    except OSError: pass\n    if os.environ.get(\"INITIAL_LOG_LEVEL\", 0) >= 10:\n        print(\"__init__: Setting weave cache to %s\" % _cache_dir_path,\n              file=sys.stderr)\nos.environ['PYTHONCOMPILED'] = _cache_dir_path\n\n# Check for MKL capability\ntry:\n    import pycbc.fft.mkl\n    HAVE_MKL=True\nexcept ImportError as e:\n    print(e)\n    HAVE_MKL=False\n    \n\n# Check for site-local flags to pass to gcc\nWEAVE_FLAGS = '-march=native -O3 -w '\nif 'WEAVE_FLAGS' in os.environ:\n    if '-march=' in os.environ['WEAVE_FLAGS']:\n        WEAVE_FLAGS = os.environ['WEAVE_FLAGS']\n    else:\n        WEAVE_FLAGS += os.environ['WEAVE_FLAGS']\n\ndef multiprocess_cache_dir():\n    import multiprocessing\n    cache_dir =  os.path.join(_cache_dir_path,  str(id(multiprocessing.current_process())))\n    os.environ['PYTHONCOMPILED'] = cache_dir\n    try: os.makedirs(cache_dir)\n    except OSError: pass\n", "path": "pycbc/__init__.py"}], "after_files": [{"content": "# Copyright (C) 2012  Alex Nitz, Josh Willis\n#\n# This program is free software; you can redistribute it and/or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation; either version 3 of the License, or (at your\n# option) any later version.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General\n# Public License for more details.\n#\n# You should have received a copy of the GNU General Public License along\n# with this program; if not, write to the Free Software Foundation, Inc.,\n# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n\n\n#\n# =============================================================================\n#\n#                                   Preamble\n#\n# =============================================================================\n#\n\"\"\"PyCBC contains a toolkit for CBC gravitational wave analysis\n\"\"\"\nfrom __future__ import (absolute_import, print_function)\nimport subprocess, os, sys, tempfile\nimport logging\nimport signal\n\ntry:\n    # This will fail when pycbc is imported during the build process,\n    # before version.py has been generated.\n    from .version import git_hash\n    from .version import version as pycbc_version\nexcept:\n    git_hash = 'none'\n    pycbc_version = 'none'\n\n__version__ = pycbc_version\n\n\ndef init_logging(verbose=False, format='%(asctime)s %(message)s'):\n    \"\"\" Common utility for setting up logging in PyCBC.\n\n    Installs a signal handler such that verbosity can be activated at\n    run-time by sending a SIGUSR1 to the process.\n    \"\"\"\n    def sig_handler(signum, frame):\n        logger = logging.getLogger()\n        log_level = logger.level\n        if log_level == logging.DEBUG:\n            log_level = logging.WARN\n        else:\n            log_level = logging.DEBUG\n        logging.warn('Got signal %d, setting log level to %d',\n                     signum, log_level)\n        logger.setLevel(log_level)\n\n    signal.signal(signal.SIGUSR1, sig_handler)\n\n    if verbose:\n        initial_level = logging.DEBUG\n    else:\n        initial_level = logging.WARN\n    logging.getLogger().setLevel(initial_level)\n    logging.basicConfig(format=format, level=initial_level)\n\n\n# Check for optional components of the PyCBC Package\ntry:\n    # This is a crude check to make sure that the driver is installed\n    try:\n        loaded_modules = subprocess.Popen(['lsmod'], stdout=subprocess.PIPE).communicate()[0]\n        loaded_modules = loaded_modules.decode()\n        if 'nvidia' not in loaded_modules:\n            raise ImportError(\"nvidia driver may not be installed correctly\")\n    except OSError:\n        pass\n\n    # Check that pycuda is installed and can talk to the driver\n    import pycuda.driver as _pycudadrv\n\n    HAVE_CUDA=True \nexcept ImportError:\n    HAVE_CUDA=False\n    \n# Check for openmp suppport, currently we pressume it exists, unless on \n# platforms (mac) that are silly and don't use the standard gcc. \nif sys.platform == 'darwin':\n    HAVE_OMP = False\nelse:\n    HAVE_OMP = True\n\n# PyCBC-Specific Constants\n\n# Set the value we want any aligned memory calls to use\n# N.B.: *Not* all pycbc memory will be aligned to multiples\n# of this value\n\nPYCBC_ALIGNMENT = 32\n\n# Dynamic range factor: a large constant for rescaling\n# GW strains.  This is 2**69 rounded to 17 sig.fig.\n\nDYN_RANGE_FAC =  5.9029581035870565e+20\n\nif os.environ.get(\"INITIAL_LOG_LEVEL\", None):\n    logging.basicConfig(format='%(asctime)s %(message)s',\n                        level=int(os.environ[\"INITIAL_LOG_LEVEL\"]))\n\n# Make sure we use a user specific, machine specific compiled cache location\n_python_name =  \"python%d%d_compiled\" % tuple(sys.version_info[:2])\n_tmp_dir = tempfile.gettempdir()\n_cache_dir_name = repr(os.getuid()) + '_' + _python_name\n_cache_dir_path = os.path.join(_tmp_dir, _cache_dir_name)\n# Append the git hash to the cache path.  This will ensure that cached \n# files are correct even in cases where weave currently doesn't realize\n# that a recompile is needed.\n# FIXME: It would be better to find a way to trigger a recompile off\n# of all the arguments to weave.\n_cache_dir_path = os.path.join(_cache_dir_path, pycbc_version)\n_cache_dir_path = os.path.join(_cache_dir_path, git_hash)\nif os.environ.get(\"NO_TMPDIR\", None):\n    if os.environ.get(\"INITIAL_LOG_LEVEL\", 0) >= 10:\n        print(\"__init__: Skipped creating %s as NO_TEMPDIR is set\"\n              % _cache_dir_path, file=sys.stderr)\nelse:\n    try: os.makedirs(_cache_dir_path)\n    except OSError: pass\n    if os.environ.get(\"INITIAL_LOG_LEVEL\", 0) >= 10:\n        print(\"__init__: Setting weave cache to %s\" % _cache_dir_path,\n              file=sys.stderr)\nos.environ['PYTHONCOMPILED'] = _cache_dir_path\n\n# Check for MKL capability\ntry:\n    import pycbc.fft.mkl\n    HAVE_MKL=True\nexcept ImportError as e:\n    print(e)\n    HAVE_MKL=False\n    \n\n# Check for site-local flags to pass to gcc\nWEAVE_FLAGS = '-march=native -O3 -w '\nif 'WEAVE_FLAGS' in os.environ:\n    if '-march=' in os.environ['WEAVE_FLAGS']:\n        WEAVE_FLAGS = os.environ['WEAVE_FLAGS']\n    else:\n        WEAVE_FLAGS += os.environ['WEAVE_FLAGS']\n\ndef multiprocess_cache_dir():\n    import multiprocessing\n    cache_dir =  os.path.join(_cache_dir_path,  str(id(multiprocessing.current_process())))\n    os.environ['PYTHONCOMPILED'] = cache_dir\n    try: os.makedirs(cache_dir)\n    except OSError: pass\n", "path": "pycbc/__init__.py"}]}